List:Commits« Previous MessageNext Message »
From:konstantin Date:November 16 2007 3:49pm
Subject:bk commit into 6.0 tree (kostja:1.2659) WL#4085
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of kostja. When kostja does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-11-16 18:49:37+03:00, kostja@bodhi.(none) +85 -0
  Implement WL#4085 Discontinue the Instance Manager.
  
  Remove the instance manager from sources and build scripts.

  BitKeeper/deleted/.del-CMakeLists.txt~57d6104cde919049@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/CMakeLists.txt -> BitKeeper/deleted/.del-CMakeLists.txt~57d6104cde919049

  BitKeeper/deleted/.del-CMakeLists.txt~cc9bc5dc17e40f5f@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/CMakeLists.txt -> BitKeeper/deleted/.del-CMakeLists.txt~cc9bc5dc17e40f5f

  BitKeeper/deleted/.del-IMService.cpp@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/IMService.cpp -> BitKeeper/deleted/.del-IMService.cpp

  BitKeeper/deleted/.del-IMService.h@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/IMService.h -> BitKeeper/deleted/.del-IMService.h

  BitKeeper/deleted/.del-Makefile.am~49d9cda479fa423d@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/Makefile.am -> BitKeeper/deleted/.del-Makefile.am~49d9cda479fa423d

  BitKeeper/deleted/.del-Makefile.am~5f532604c8196eea@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/Makefile.am -> BitKeeper/deleted/.del-Makefile.am~5f532604c8196eea

  BitKeeper/deleted/.del-README~7db734c37933d81@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/README -> BitKeeper/deleted/.del-README~7db734c37933d81

  BitKeeper/deleted/.del-WindowsService.cpp@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/WindowsService.cpp -> BitKeeper/deleted/.del-WindowsService.cpp

  BitKeeper/deleted/.del-WindowsService.h@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/WindowsService.h -> BitKeeper/deleted/.del-WindowsService.h

  BitKeeper/deleted/.del-angel.cc@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/angel.cc -> BitKeeper/deleted/.del-angel.cc

  BitKeeper/deleted/.del-angel.h@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/angel.h -> BitKeeper/deleted/.del-angel.h

  BitKeeper/deleted/.del-buffer.cc@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/buffer.cc -> BitKeeper/deleted/.del-buffer.cc

  BitKeeper/deleted/.del-buffer.h@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/buffer.h -> BitKeeper/deleted/.del-buffer.h

  BitKeeper/deleted/.del-command.cc@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/command.cc -> BitKeeper/deleted/.del-command.cc

  BitKeeper/deleted/.del-command.h@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/command.h -> BitKeeper/deleted/.del-command.h

  BitKeeper/deleted/.del-commands.cc@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/commands.cc -> BitKeeper/deleted/.del-commands.cc

  BitKeeper/deleted/.del-commands.h@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/commands.h -> BitKeeper/deleted/.del-commands.h

  BitKeeper/deleted/.del-disabled.def~2114177dcf31c9f@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/disabled.def -> BitKeeper/deleted/.del-disabled.def~2114177dcf31c9f

  BitKeeper/deleted/.del-exit_codes.h@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/exit_codes.h -> BitKeeper/deleted/.del-exit_codes.h

  BitKeeper/deleted/.del-guardian.cc@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/guardian.cc -> BitKeeper/deleted/.del-guardian.cc

  BitKeeper/deleted/.del-guardian.h@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/guardian.h -> BitKeeper/deleted/.del-guardian.h

  BitKeeper/deleted/.del-im_check_env.inc@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/im_check_env.inc -> BitKeeper/deleted/.del-im_check_env.inc

  BitKeeper/deleted/.del-im_cmd_line.imtest@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/im_cmd_line.imtest -> BitKeeper/deleted/.del-im_cmd_line.imtest

  BitKeeper/deleted/.del-im_cmd_line.result@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/r/im_cmd_line.result -> BitKeeper/deleted/.del-im_cmd_line.result

  BitKeeper/deleted/.del-im_daemon_life_cycle-im.opt@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/im_daemon_life_cycle-im.opt -> BitKeeper/deleted/.del-im_daemon_life_cycle-im.opt

  BitKeeper/deleted/.del-im_daemon_life_cycle.imtest@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/im_daemon_life_cycle.imtest -> BitKeeper/deleted/.del-im_daemon_life_cycle.imtest

  BitKeeper/deleted/.del-im_daemon_life_cycle.result@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/r/im_daemon_life_cycle.result -> BitKeeper/deleted/.del-im_daemon_life_cycle.result

  BitKeeper/deleted/.del-im_instance_conf-im.opt@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/im_instance_conf-im.opt -> BitKeeper/deleted/.del-im_instance_conf-im.opt

  BitKeeper/deleted/.del-im_instance_conf.imtest@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/im_instance_conf.imtest -> BitKeeper/deleted/.del-im_instance_conf.imtest

  BitKeeper/deleted/.del-im_instance_conf.result@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/r/im_instance_conf.result -> BitKeeper/deleted/.del-im_instance_conf.result

  BitKeeper/deleted/.del-im_life_cycle-im.opt~f409d379f797c2d3@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/im_life_cycle-im.opt -> BitKeeper/deleted/.del-im_life_cycle-im.opt~f409d379f797c2d3

  BitKeeper/deleted/.del-im_life_cycle.imtest@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/im_life_cycle.imtest -> BitKeeper/deleted/.del-im_life_cycle.imtest

  BitKeeper/deleted/.del-im_life_cycle.result@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/r/im_life_cycle.result -> BitKeeper/deleted/.del-im_life_cycle.result

  BitKeeper/deleted/.del-im_options-im.opt@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/im_options-im.opt -> BitKeeper/deleted/.del-im_options-im.opt

  BitKeeper/deleted/.del-im_options.imtest@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/im_options.imtest -> BitKeeper/deleted/.del-im_options.imtest

  BitKeeper/deleted/.del-im_options.result@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/r/im_options.result -> BitKeeper/deleted/.del-im_options.result

  BitKeeper/deleted/.del-im_utils-im.opt~f9890de5f4854525@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/im_utils-im.opt -> BitKeeper/deleted/.del-im_utils-im.opt~f9890de5f4854525

  BitKeeper/deleted/.del-im_utils.imtest@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/im_utils.imtest -> BitKeeper/deleted/.del-im_utils.imtest

  BitKeeper/deleted/.del-im_utils.result@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/r/im_utils.result -> BitKeeper/deleted/.del-im_utils.result

  BitKeeper/deleted/.del-instance.cc@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/instance.cc -> BitKeeper/deleted/.del-instance.cc

  BitKeeper/deleted/.del-instance.h@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/instance.h -> BitKeeper/deleted/.del-instance.h

  BitKeeper/deleted/.del-instance_map.cc@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/instance_map.cc -> BitKeeper/deleted/.del-instance_map.cc

  BitKeeper/deleted/.del-instance_map.h@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/instance_map.h -> BitKeeper/deleted/.del-instance_map.h

  BitKeeper/deleted/.del-instance_options.cc@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/instance_options.cc -> BitKeeper/deleted/.del-instance_options.cc

  BitKeeper/deleted/.del-instance_options.h@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/instance_options.h -> BitKeeper/deleted/.del-instance_options.h

  BitKeeper/deleted/.del-kill_n_check.sh@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/kill_n_check.sh -> BitKeeper/deleted/.del-kill_n_check.sh

  BitKeeper/deleted/.del-listener.cc@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/listener.cc -> BitKeeper/deleted/.del-listener.cc

  BitKeeper/deleted/.del-listener.h@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/listener.h -> BitKeeper/deleted/.del-listener.h

  BitKeeper/deleted/.del-log.cc@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/log.cc -> BitKeeper/deleted/.del-log.cc

  BitKeeper/deleted/.del-log.h~6b34e5cb456d7ac6@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/log.h -> BitKeeper/deleted/.del-log.h~6b34e5cb456d7ac6

  BitKeeper/deleted/.del-log.sh@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/log.sh -> BitKeeper/deleted/.del-log.sh

  BitKeeper/deleted/.del-manager.cc@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/manager.cc -> BitKeeper/deleted/.del-manager.cc

  BitKeeper/deleted/.del-manager.h@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/manager.h -> BitKeeper/deleted/.del-manager.h

  BitKeeper/deleted/.del-messages.cc@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/messages.cc -> BitKeeper/deleted/.del-messages.cc

  BitKeeper/deleted/.del-messages.h@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/messages.h -> BitKeeper/deleted/.del-messages.h

  BitKeeper/deleted/.del-mtr_im.pl~9762b0336c28949@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/lib/mtr_im.pl -> BitKeeper/deleted/.del-mtr_im.pl~9762b0336c28949

  BitKeeper/deleted/.del-mysql_connection.cc@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/mysql_connection.cc -> BitKeeper/deleted/.del-mysql_connection.cc

  BitKeeper/deleted/.del-mysql_connection.h@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/mysql_connection.h -> BitKeeper/deleted/.del-mysql_connection.h

  BitKeeper/deleted/.del-mysql_manager_error.h@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/mysql_manager_error.h -> BitKeeper/deleted/.del-mysql_manager_error.h

  BitKeeper/deleted/.del-mysqlmanager.cc@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/mysqlmanager.cc -> BitKeeper/deleted/.del-mysqlmanager.cc

  BitKeeper/deleted/.del-mysqlmanager.vcproj@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/mysqlmanager.vcproj -> BitKeeper/deleted/.del-mysqlmanager.vcproj

  BitKeeper/deleted/.del-options.cc@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/options.cc -> BitKeeper/deleted/.del-options.cc

  BitKeeper/deleted/.del-options.h@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/options.h -> BitKeeper/deleted/.del-options.h

  BitKeeper/deleted/.del-parse.cc@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/parse.cc -> BitKeeper/deleted/.del-parse.cc

  BitKeeper/deleted/.del-parse.h@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/parse.h -> BitKeeper/deleted/.del-parse.h

  BitKeeper/deleted/.del-parse_output.cc@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/parse_output.cc -> BitKeeper/deleted/.del-parse_output.cc

  BitKeeper/deleted/.del-parse_output.h@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/parse_output.h -> BitKeeper/deleted/.del-parse_output.h

  BitKeeper/deleted/.del-portability.h@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/portability.h -> BitKeeper/deleted/.del-portability.h

  BitKeeper/deleted/.del-priv.cc@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/priv.cc -> BitKeeper/deleted/.del-priv.cc

  BitKeeper/deleted/.del-priv.h@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/priv.h -> BitKeeper/deleted/.del-priv.h

  BitKeeper/deleted/.del-protocol.cc@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/protocol.cc -> BitKeeper/deleted/.del-protocol.cc

  BitKeeper/deleted/.del-protocol.h@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/protocol.h -> BitKeeper/deleted/.del-protocol.h

  BitKeeper/deleted/.del-thread_registry.cc@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/thread_registry.cc -> BitKeeper/deleted/.del-thread_registry.cc

  BitKeeper/deleted/.del-thread_registry.h@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/thread_registry.h -> BitKeeper/deleted/.del-thread_registry.h

  BitKeeper/deleted/.del-user_management_commands.cc@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/user_management_commands.cc -> BitKeeper/deleted/.del-user_management_commands.cc

  BitKeeper/deleted/.del-user_management_commands.h@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/user_management_commands.h -> BitKeeper/deleted/.del-user_management_commands.h

  BitKeeper/deleted/.del-user_map.cc@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/user_map.cc -> BitKeeper/deleted/.del-user_map.cc

  BitKeeper/deleted/.del-user_map.h@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: server-tools/instance-manager/user_map.h -> BitKeeper/deleted/.del-user_map.h

  BitKeeper/deleted/.del-utils.sh@stripped, 2007-11-15 22:20:11+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/utils.sh -> BitKeeper/deleted/.del-utils.sh

  BitKeeper/deleted/.del-wait_for_process.sh@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/wait_for_process.sh -> BitKeeper/deleted/.del-wait_for_process.sh

  BitKeeper/deleted/.del-wait_for_socket.sh@stripped, 2007-11-15 22:20:12+03:00, kostja@bodhi.(none) +0 -0
    Rename: mysql-test/suite/im/t/wait_for_socket.sh -> BitKeeper/deleted/.del-wait_for_socket.sh

  CMakeLists.txt@stripped, 2007-11-16 18:49:25+03:00, kostja@bodhi.(none) +0 -1
    Remove the instance manager.

  Makefile.am@stripped, 2007-11-16 18:49:26+03:00, kostja@bodhi.(none) +2 -2
    Remove the instance manager.

  configure.in@stripped, 2007-11-16 18:49:26+03:00, kostja@bodhi.(none) +0 -14
    Remove the instance manager.

  mysql-test/mysql-test-run.pl@stripped, 2007-11-16 18:49:26+03:00, kostja@bodhi.(none) +7 -310
    Remove the instance manager.

diff -Nrup a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt	2007-10-24 20:05:00 +04:00
+++ b/CMakeLists.txt	2007-11-16 18:49:25 +03:00
@@ -245,7 +245,6 @@ IF(WITH_FALCON_STORAGE_ENGINE)
   ADD_SUBDIRECTORY(storage/falcon)
 ENDIF(WITH_FALCON_STORAGE_ENGINE)
 ADD_SUBDIRECTORY(sql)
-ADD_SUBDIRECTORY(server-tools/instance-manager)
 ADD_SUBDIRECTORY(libmysql)
 ADD_SUBDIRECTORY(tests)
 ADD_SUBDIRECTORY(unittest/mytap)
diff -Nrup a/Makefile.am b/Makefile.am
--- a/Makefile.am	2007-10-30 22:06:46 +03:00
+++ b/Makefile.am	2007-11-16 18:49:26 +03:00
@@ -27,7 +27,7 @@ SUBDIRS =		. include @docs_dirs@ @zlib_d
 			@sql_union_dirs@ unittest storage plugin \
 			@sql_server@ @man_dirs@ tests \
 			netware @libmysqld_dirs@ \
-			mysql-test support-files sql-bench @tools_dirs@ \
+			mysql-test support-files sql-bench \
 			win
 
 DIST_SUBDIRS =		. include Docs zlib \
@@ -36,7 +36,7 @@ DIST_SUBDIRS =		. include Docs zlib \
 			strings mysys dbug extra regex libmysql libmysql_r client unittest storage plugin \
 			vio sql man tests \
 			netware libmysqld \
-			mysql-test support-files sql-bench server-tools \
+			mysql-test support-files sql-bench \
 			win \
 			BUILD
 DISTCLEANFILES = ac_available_languages_fragment
diff -Nrup a/configure.in b/configure.in
--- a/configure.in	2007-11-05 21:17:36 +03:00
+++ b/configure.in	2007-11-16 18:49:26 +03:00
@@ -2346,19 +2346,6 @@ then
             [Access checks in embedded library])
 fi
 
-tools_dirs=""
-
-AC_ARG_WITH([mysqlmanager],
-  AC_HELP_STRING([--with-mysqlmanager], [Build the mysqlmanager binary: yes/no (default: build if server is built.)]),,)
-
-if test "$with_mysqlmanager" = "yes" -o \
-        '(' "$with_mysqlmanager:$with_server" = ":yes" -a \
-            -d "$srcdir/server-tools" ')' ; then
-  tools_dirs="server-tools"
-fi
-
-AC_SUBST(tools_dirs)
-
 #MYSQL_CHECK_CPU
 
 libmysqld_dirs=
@@ -2683,7 +2670,6 @@ AC_CONFIG_FILES(Makefile extra/Makefile 
  dbug/Makefile scripts/Makefile include/Makefile dnl
  tests/Makefile Docs/Makefile support-files/Makefile dnl
  support-files/MacOSX/Makefile support-files/RHEL4-SElinux/Makefile dnl
- server-tools/Makefile server-tools/instance-manager/Makefile dnl
  cmd-line-utils/Makefile cmd-line-utils/libedit/Makefile dnl
  libmysqld/Makefile libmysqld/examples/Makefile dnl
  mysql-test/Makefile dnl
diff -Nrup a/mysql-test/lib/mtr_im.pl b/mysql-test/lib/mtr_im.pl
--- a/mysql-test/lib/mtr_im.pl	2006-12-30 20:29:18 +03:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,775 +0,0 @@
-# -*- cperl -*-
-# Copyright (C) 2006 MySQL AB
-# 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-# This is a library file used by the Perl version of mysql-test-run,
-# and is part of the translation of the Bourne shell script with the
-# same name.
-
-use strict;
-
-# Private IM-related operations.
-
-sub mtr_im_kill_process ($$$$);
-sub mtr_im_load_pids ($);
-sub mtr_im_terminate ($);
-sub mtr_im_check_alive ($);
-sub mtr_im_check_main_alive ($);
-sub mtr_im_check_angel_alive ($);
-sub mtr_im_check_mysqlds_alive ($);
-sub mtr_im_check_mysqld_alive ($);
-sub mtr_im_cleanup ($);
-sub mtr_im_rm_file ($);
-sub mtr_im_errlog ($);
-sub mtr_im_kill ($);
-sub mtr_im_wait_for_connection ($$$);
-sub mtr_im_wait_for_mysqld($$$);
-
-# Public IM-related operations.
-
-sub mtr_im_start ($$);
-sub mtr_im_stop ($);
-
-##############################################################################
-#
-#  Private operations.
-#
-##############################################################################
-
-sub mtr_im_kill_process ($$$$) {
-  my $pid_lst= shift;
-  my $signal= shift;
-  my $total_retries= shift;
-  my $timeout= shift;
-
-  my %pids;
-
-  foreach my $pid ( @{$pid_lst} )
-  {
-    $pids{$pid}= 1;
-  }
-
-  for ( my $cur_attempt= 1; $cur_attempt <= $total_retries; ++$cur_attempt )
-  {
-    foreach my $pid ( keys %pids )
-    {
-      mtr_debug("Sending $signal to $pid...");
-
-      kill($signal, $pid);
-
-      unless ( kill (0, $pid) )
-      {
-        mtr_debug("Process $pid died.");
-        delete $pids{$pid};
-      }
-    }
-
-    return if scalar keys %pids == 0;
-
-    mtr_debug("Sleeping $timeout second(s) waiting for processes to die...");
-
-    sleep($timeout);
-  }
-
-  mtr_debug("Process(es) " .
-            join(' ', keys %pids) .
-            " is still alive after $total_retries " .
-            "of sending signal $signal.");
-}
-
-###########################################################################
-
-sub mtr_im_load_pids($) {
-  my $im= shift;
-
-  mtr_debug("Loading PID files...");
-
-  # Obtain mysqld-process pids.
-
-  my $instances = $im->{'instances'};
-
-  for ( my $idx= 0; $idx < 2; ++$idx )
-  {
-    mtr_debug("IM-guarded mysqld[$idx] PID file: '" .
-              $instances->[$idx]->{'path_pid'} . "'.");
-
-    my $mysqld_pid;
-
-    if ( -r $instances->[$idx]->{'path_pid'} )
-    {
-      $mysqld_pid= mtr_get_pid_from_file($instances->[$idx]->{'path_pid'});
-      mtr_debug("IM-guarded mysqld[$idx] PID: $mysqld_pid.");
-    }
-    else
-    {
-      $mysqld_pid= undef;
-      mtr_debug("IM-guarded mysqld[$idx]: no PID file.");
-    }
-
-    $instances->[$idx]->{'pid'}= $mysqld_pid;
-  }
-
-  # Re-read Instance Manager PIDs from the file, since during tests Instance
-  # Manager could have been restarted, so its PIDs could have been changed.
-
-  #   - IM-main
-
-  mtr_debug("IM-main PID file: '$im->{path_pid}'.");
-
-  if ( -f $im->{'path_pid'} )
-  {
-    $im->{'pid'} =
-      mtr_get_pid_from_file($im->{'path_pid'});
-
-    mtr_debug("IM-main PID: $im->{pid}.");
-  }
-  else
-  {
-    mtr_debug("IM-main: no PID file.");
-    $im->{'pid'}= undef;
-  }
-
-  #   - IM-angel
-
-  mtr_debug("IM-angel PID file: '$im->{path_angel_pid}'.");
-
-  if ( -f $im->{'path_angel_pid'} )
-  {
-    $im->{'angel_pid'} =
-      mtr_get_pid_from_file($im->{'path_angel_pid'});
-
-    mtr_debug("IM-angel PID: $im->{'angel_pid'}.");
-  }
-  else
-  {
-    mtr_debug("IM-angel: no PID file.");
-    $im->{'angel_pid'} = undef;
-  }
-}
-
-###########################################################################
-
-sub mtr_im_terminate($) {
-  my $im= shift;
-
-  # Load pids from pid-files. We should do it first of all, because IM deletes
-  # them on shutdown.
-
-  mtr_im_load_pids($im);
-
-  mtr_debug("Shutting Instance Manager down...");
-
-  # Ignoring SIGCHLD so that all children could rest in peace.
-
-  start_reap_all();
-
-  # Send SIGTERM to IM-main.
-
-  if ( defined $im->{'pid'} )
-  {
-    mtr_debug("IM-main pid: $im->{pid}.");
-    mtr_debug("Stopping IM-main...");
-
-    mtr_im_kill_process([ $im->{'pid'} ], 'TERM', 10, 1);
-  }
-  else
-  {
-    mtr_debug("IM-main pid: n/a.");
-  }
-
-  # If IM-angel was alive, wait for it to die.
-
-  if ( defined $im->{'angel_pid'} )
-  {
-    mtr_debug("IM-angel pid: $im->{'angel_pid'}.");
-    mtr_debug("Waiting for IM-angel to die...");
-
-    my $total_attempts= 10;
-
-    for ( my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt )
-    {
-      unless ( kill (0, $im->{'angel_pid'}) )
-      {
-        mtr_debug("IM-angel died.");
-        last;
-      }
-
-      sleep(1);
-    }
-  }
-  else
-  {
-    mtr_debug("IM-angel pid: n/a.");
-  }
-
-  stop_reap_all();
-
-  # Re-load PIDs.
-
-  mtr_im_load_pids($im);
-}
-
-###########################################################################
-
-sub mtr_im_check_alive($) {
-  my $im= shift;
-
-  mtr_debug("Checking whether IM-components are alive...");
-
-  return 1 if mtr_im_check_main_alive($im);
-
-  return 1 if mtr_im_check_angel_alive($im);
-
-  return 1 if mtr_im_check_mysqlds_alive($im);
-
-  return 0;
-}
-
-###########################################################################
-
-sub mtr_im_check_main_alive($) {
-  my $im= shift;
-
-  # Check that the process, that we know to be IM's, is dead.
-
-  if ( defined $im->{'pid'} )
-  {
-    if ( kill (0, $im->{'pid'}) )
-    {
-      mtr_debug("IM-main (PID: $im->{pid}) is alive.");
-      return 1;
-    }
-    else
-    {
-      mtr_debug("IM-main (PID: $im->{pid}) is dead.");
-    }
-  }
-  else
-  {
-    mtr_debug("No PID file for IM-main.");
-  }
-
-  # Check that IM does not accept client connections.
-
-  if ( mtr_ping_port($im->{'port'}) )
-  {
-    mtr_debug("IM-main (port: $im->{port}) " .
-              "is accepting connections.");
-
-    mtr_im_errlog("IM-main is accepting connections on port " .
-                  "$im->{port}, but there is no " .
-                  "process information.");
-    return 1;
-  }
-  else
-  {
-    mtr_debug("IM-main (port: $im->{port}) " .
-              "does not accept connections.");
-    return 0;
-  }
-}
-
-###########################################################################
-
-sub mtr_im_check_angel_alive($) {
-  my $im= shift;
-
-  # Check that the process, that we know to be the Angel, is dead.
-
-  if ( defined $im->{'angel_pid'} )
-  {
-    if ( kill (0, $im->{'angel_pid'}) )
-    {
-      mtr_debug("IM-angel (PID: $im->{angel_pid}) is alive.");
-      return 1;
-    }
-    else
-    {
-      mtr_debug("IM-angel (PID: $im->{angel_pid}) is dead.");
-      return 0;
-    }
-  }
-  else
-  {
-    mtr_debug("No PID file for IM-angel.");
-    return 0;
-  }
-}
-
-###########################################################################
-
-sub mtr_im_check_mysqlds_alive($) {
-  my $im= shift;
-
-  mtr_debug("Checking for IM-guarded mysqld instances...");
-
-  my $instances = $im->{'instances'};
-
-  for ( my $idx= 0; $idx < 2; ++$idx )
-  {
-    mtr_debug("Checking mysqld[$idx]...");
-
-    return 1
-      if mtr_im_check_mysqld_alive($instances->[$idx]);
-  }
-}
-
-###########################################################################
-
-sub mtr_im_check_mysqld_alive($) {
-  my $mysqld_instance= shift;
-
-  # Check that the process is dead.
-
-  if ( defined $mysqld_instance->{'pid'} )
-  {
-    if ( kill (0, $mysqld_instance->{'pid'}) )
-    {
-      mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is alive.");
-      return 1;
-    }
-    else
-    {
-      mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is dead.");
-    }
-  }
-  else
-  {
-    mtr_debug("No PID file for mysqld instance.");
-  }
-
-  # Check that mysqld does not accept client connections.
-
-  if ( mtr_ping_port($mysqld_instance->{'port'}) )
-  {
-    mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
-              "is accepting connections.");
-
-    mtr_im_errlog("Mysqld is accepting connections on port " .
-                  "$mysqld_instance->{port}, but there is no " .
-                  "process information.");
-    return 1;
-  }
-  else
-  {
-    mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
-              "does not accept connections.");
-    return 0;
-  }
-}
-
-###########################################################################
-
-sub mtr_im_cleanup($) {
-  my $im= shift;
-
-  mtr_im_rm_file($im->{'path_pid'});
-  mtr_im_rm_file($im->{'path_sock'});
-
-  mtr_im_rm_file($im->{'path_angel_pid'});
-
-  for ( my $idx= 0; $idx < 2; ++$idx )
-  {
-    mtr_im_rm_file($im->{'instances'}->[$idx]->{'path_pid'});
-    mtr_im_rm_file($im->{'instances'}->[$idx]->{'path_sock'});
-  }
-}
-
-###########################################################################
-
-sub mtr_im_rm_file($)
-{
-  my $file_path= shift;
-
-  if ( -f $file_path )
-  {
-    mtr_debug("Removing '$file_path'...");
-
-    unless ( unlink($file_path) )
-    {
-      mtr_warning("Can not remove '$file_path'.")
-    }
-  }
-  else
-  {
-    mtr_debug("File '$file_path' does not exist already.");
-  }
-}
-
-###########################################################################
-
-sub mtr_im_errlog($) {
-  my $msg= shift;
-
-  # Complain in error log so that a warning will be shown.
-  # 
-  # TODO: unless BUG#20761 is fixed, we will print the warning to stdout, so
-  # that it can be seen on console and does not produce pushbuild error.
-
-  # my $errlog= "$opt_vardir/log/mysql-test-run.pl.err";
-  # 
-  # open (ERRLOG, ">>$errlog") ||
-  #   mtr_error("Can not open error log ($errlog)");
-  # 
-  # my $ts= localtime();
-  # print ERRLOG
-  #   "Warning: [$ts] $msg\n";
-  # 
-  # close ERRLOG;
-
-  my $ts= localtime();
-  print "Warning: [$ts] $msg\n";
-}
-
-###########################################################################
-
-sub mtr_im_kill($) {
-  my $im= shift;
-
-  # Re-load PIDs. That can be useful because some processes could have been
-  # restarted.
-
-  mtr_im_load_pids($im);
-
-  # Ignoring SIGCHLD so that all children could rest in peace.
-
-  start_reap_all();
-
-  # Kill IM-angel first of all.
-
-  if ( defined $im->{'angel_pid'} )
-  {
-    mtr_debug("Killing IM-angel (PID: $im->{angel_pid})...");
-    mtr_im_kill_process([ $im->{'angel_pid'} ], 'KILL', 10, 1)
-  }
-  else
-  {
-    mtr_debug("IM-angel is dead.");
-  }
-
-  # Re-load PIDs again.
-
-  mtr_im_load_pids($im);
-
-  # Kill IM-main.
-  
-  if ( defined $im->{'pid'} )
-  {
-    mtr_debug("Killing IM-main (PID: $im->pid})...");
-    mtr_im_kill_process([ $im->{'pid'} ], 'KILL', 10, 1);
-  }
-  else
-  {
-    mtr_debug("IM-main is dead.");
-  }
-
-  # Re-load PIDs again.
-
-  mtr_im_load_pids($im);
-
-  # Kill guarded mysqld instances.
-
-  my @mysqld_pids;
-
-  mtr_debug("Collecting PIDs of mysqld instances to kill...");
-
-  for ( my $idx= 0; $idx < 2; ++$idx )
-  {
-    my $pid= $im->{'instances'}->[$idx]->{'pid'};
-
-    unless ( defined $pid )
-    {
-      next;
-    }
-
-    mtr_debug("  - IM-guarded mysqld[$idx] PID: $pid.");
-
-    push (@mysqld_pids, $pid);
-  }
-
-  if ( scalar @mysqld_pids > 0 )
-  {
-    mtr_debug("Killing IM-guarded mysqld instances...");
-    mtr_im_kill_process(\@mysqld_pids, 'KILL', 10, 1);
-  }
-
-  # That's all.
-
-  stop_reap_all();
-}
-
-##############################################################################
-
-sub mtr_im_wait_for_connection($$$) {
-  my $im= shift;
-  my $total_attempts= shift;
-  my $connect_timeout= shift;
-
-  mtr_debug("Waiting for IM on port $im->{port} " .
-            "to start accepting connections...");
-
-  for ( my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt )
-  {
-    mtr_debug("Trying to connect to IM ($cur_attempt of $total_attempts)...");
-
-    if ( mtr_ping_port($im->{'port'}) )
-    {
-      mtr_debug("IM is accepting connections " .
-                "on port $im->{port}.");
-      return 1;
-    }
-
-    mtr_debug("Sleeping $connect_timeout...");
-    sleep($connect_timeout);
-  }
-
-  mtr_debug("IM does not accept connections " .
-            "on port $im->{port} after " .
-            ($total_attempts * $connect_timeout) . " seconds.");
-
-  return 0;
-}
-
-##############################################################################
-
-sub mtr_im_wait_for_mysqld($$$) {
-  my $mysqld= shift;
-  my $total_attempts= shift;
-  my $connect_timeout= shift;
-
-  mtr_debug("Waiting for IM-guarded mysqld on port $mysqld->{port} " .
-            "to start accepting connections...");
-
-  for ( my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt )
-  {
-    mtr_debug("Trying to connect to mysqld " .
-              "($cur_attempt of $total_attempts)...");
-
-    if ( mtr_ping_port($mysqld->{'port'}) )
-    {
-      mtr_debug("Mysqld is accepting connections " .
-                "on port $mysqld->{port}.");
-      return 1;
-    }
-
-    mtr_debug("Sleeping $connect_timeout...");
-    sleep($connect_timeout);
-  }
-
-  mtr_debug("Mysqld does not accept connections " .
-            "on port $mysqld->{port} after " .
-            ($total_attempts * $connect_timeout) . " seconds.");
-
-  return 0;
-}
-
-##############################################################################
-#
-#  Public operations.
-#
-##############################################################################
-
-sub mtr_im_start($$) {
-  my $im = shift;
-  my $opts = shift;
-
-  mtr_debug("Starting Instance Manager...");
-
-  my $args;
-  mtr_init_args(\$args);
-  mtr_add_arg($args, "--defaults-file=%s", $im->{'defaults_file'});
-
-  foreach my $opt ( @{$opts} )
-  {
-    mtr_add_arg($args, $opt);
-  }
-
-  $im->{'spawner_pid'} =
-    mtr_spawn(
-      $::exe_im,                        # path to the executable
-      $args,                            # cmd-line args
-      '',                               # stdin
-      $im->{'path_log'},                # stdout
-      $im->{'path_err'},                # stderr
-      '',                               # pid file path (not used)
-      { append_log_file => 1 }          # append log files
-      );
-
-  unless ( $im->{'spawner_pid'} )
-  {
-    mtr_error('Could not start Instance Manager.')
-  }
-
-  # Instance Manager can be run in daemon mode. In this case, it creates
-  # several processes and the parent process, created by mtr_spawn(), exits just
-  # after start. So, we have to obtain Instance Manager PID from the PID file.
-
-  mtr_debug("Waiting for IM to create PID file (" .
-            "path: '$im->{path_pid}'; " .
-            "timeout: $im->{start_timeout})...");
-
-  unless ( sleep_until_file_created($im->{'path_pid'},
-                                    $im->{'start_timeout'},
-                                    -1) ) # real PID is still unknown
-  {
-    mtr_debug("IM has not created PID file in $im->{start_timeout} secs.");
-    mtr_debug("Aborting test suite...");
-
-    mtr_kill_leftovers();
-
-    mtr_report("IM has not created PID file in $im->{start_timeout} secs.");
-    return 0;
-  }
-
-  $im->{'pid'}= mtr_get_pid_from_file($im->{'path_pid'});
-
-  mtr_debug("Instance Manager started. PID: $im->{pid}.");
-
-  # Wait until we can connect to IM.
-
-  my $IM_CONNECT_TIMEOUT= 30;
-
-  unless ( mtr_im_wait_for_connection($im,
-                                      $IM_CONNECT_TIMEOUT, 1) )
-  {
-    mtr_debug("Can not connect to Instance Manager " .
-              "in $IM_CONNECT_TIMEOUT seconds after start.");
-    mtr_debug("Aborting test suite...");
-
-    mtr_kill_leftovers();
-
-    mtr_report("Can not connect to Instance Manager " .
-               "in $IM_CONNECT_TIMEOUT seconds after start.");
-    return 0;
-  }
-
-  # Wait for IM to start guarded instances:
-  #   - wait for PID files;
-
-  mtr_debug("Waiting for guarded mysqlds instances to create PID files...");
-
-  for ( my $idx= 0; $idx < 2; ++$idx )
-  {
-    my $mysqld= $im->{'instances'}->[$idx];
-
-    if ( exists $mysqld->{'nonguarded'} )
-    {
-      next;
-    }
-
-    mtr_debug("Waiting for mysqld[$idx] to create PID file (" .
-              "path: '$mysqld->{path_pid}'; " .
-              "timeout: $mysqld->{start_timeout})...");
-
-    unless ( sleep_until_file_created($mysqld->{'path_pid'},
-                                      $mysqld->{'start_timeout'},
-                                      -1) ) # real PID is still unknown
-    {
-      mtr_debug("mysqld[$idx] has not created PID file in " .
-                 "$mysqld->{start_timeout} secs.");
-      mtr_debug("Aborting test suite...");
-
-      mtr_kill_leftovers();
-
-      mtr_report("mysqld[$idx] has not created PID file in " .
-                 "$mysqld->{start_timeout} secs.");
-      return 0;
-    }
-
-    mtr_debug("PID file for mysqld[$idx] ($mysqld->{path_pid} created.");
-  }
-
-  # Wait until we can connect to guarded mysqld-instances
-  # (in other words -- wait for IM to start guarded instances).
-
-  mtr_debug("Waiting for guarded mysqlds to start accepting connections...");
-
-  for ( my $idx= 0; $idx < 2; ++$idx )
-  {
-    my $mysqld= $im->{'instances'}->[$idx];
-
-    if ( exists $mysqld->{'nonguarded'} )
-    {
-      next;
-    }
-
-    mtr_debug("Waiting for mysqld[$idx] to accept connection...");
-
-    unless ( mtr_im_wait_for_mysqld($mysqld, 30, 1) )
-    {
-      mtr_debug("Can not connect to mysqld[$idx] " .
-                "in $IM_CONNECT_TIMEOUT seconds after start.");
-      mtr_debug("Aborting test suite...");
-
-      mtr_kill_leftovers();
-
-      mtr_report("Can not connect to mysqld[$idx] " .
-                 "in $IM_CONNECT_TIMEOUT seconds after start.");
-      return 0;
-    }
-
-    mtr_debug("mysqld[$idx] started.");
-  }
-
-  mtr_debug("Instance Manager and its components are up and running.");
-
-  return 1;
-}
-
-##############################################################################
-
-sub mtr_im_stop($) {
-  my $im= shift;
-
-  mtr_debug("Stopping Instance Manager...");
-
-  # Try graceful shutdown.
-
-  mtr_im_terminate($im);
-
-  # Check that all processes died.
-
-  unless ( mtr_im_check_alive($im) )
-  {
-    mtr_debug("Instance Manager has been stopped successfully.");
-    mtr_im_cleanup($im);
-    return 1;
-  }
-
-  # Instance Manager don't want to die. We should kill it.
-
-  mtr_im_errlog("Instance Manager did not shutdown gracefully.");
-
-  mtr_im_kill($im);
-
-  # Check again that all IM-related processes have been killed.
-
-  my $im_is_alive= mtr_im_check_alive($im);
-
-  mtr_im_cleanup($im);
-
-  if ( $im_is_alive )
-  {
-    mtr_debug("Can not kill Instance Manager or its children.");
-    return 0;
-  }
-
-  mtr_debug("Instance Manager has been killed successfully.");
-  return 1;
-}
-
-###########################################################################
-
-1;
diff -Nrup a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
--- a/mysql-test/mysql-test-run.pl	2007-11-01 13:44:01 +03:00
+++ b/mysql-test/mysql-test-run.pl	2007-11-16 18:49:26 +03:00
@@ -75,7 +75,6 @@ our $glob_win32=       ($glob_win32_perl
 our $glob_netware=     ($^O eq "NetWare"); # NetWare
 
 require "lib/mtr_cases.pl";
-require "lib/mtr_im.pl";
 require "lib/mtr_process.pl";
 require "lib/mtr_timer.pl";
 require "lib/mtr_io.pl";
@@ -153,7 +152,6 @@ our $exe_mysqltest;
 our $exe_ndbd;
 our $exe_ndb_mgmd;
 our $exe_slave_mysqld;
-our $exe_im;
 our $exe_my_print_defaults;
 our $exe_perror;
 our $lib_udf_example;
@@ -214,13 +212,8 @@ our $master;
 our $slave;
 our $clusters;
 
-our $instance_manager;
-
 our $opt_master_myport;
 our $opt_slave_myport;
-our $im_port;
-our $im_mysqld1_port;
-our $im_mysqld2_port;
 our $opt_ndbcluster_port;
 our $opt_ndbconnectstring;
 our $opt_ndbcluster_port_slave;
@@ -236,7 +229,6 @@ our $max_slave_num= 0;
 our $max_master_num= 1;
 our $use_innodb;
 our $opt_skip_test;
-our $opt_skip_im;
 
 our $opt_sleep;
 
@@ -398,7 +390,7 @@ sub main () {
     my $tests= collect_test_cases($opt_suites);
 
     # Turn off NDB and other similar options if no tests use it
-    my ($need_ndbcluster,$need_im);
+    my ($need_ndbcluster);
     foreach my $test (@$tests)
     {
       next if $test->{skip};
@@ -406,7 +398,6 @@ sub main () {
       if (!$opt_extern)
       {
 	$need_ndbcluster||= $test->{ndb_test};
-	$need_im||= $test->{component_id} eq 'im';
 
 	# Count max number of slaves used by a test case
 	if ( $test->{slave_num} > $max_slave_num) {
@@ -437,12 +428,6 @@ sub main () {
       $opt_skip_ndbcluster_slave= 1;
     }
 
-    # Check if im can be skipped
-    if ( ! $need_im )
-    {
-     $opt_skip_im= 1;
-    }
-
     initialize_servers();
 
     if ( $opt_report_features ) {
@@ -471,9 +456,6 @@ sub command_line_setup () {
   $opt_slave_myport=           9308;
   $opt_ndbcluster_port=        9310;
   $opt_ndbcluster_port_slave=  9311;
-  $im_port=                    9312;
-  $im_mysqld1_port=            9313;
-  $im_mysqld2_port=            9314;
   
   # If so requested, we try to avail ourselves of a unique build thread number.
   if ( $ENV{'MTR_BUILD_THREAD'} ) {
@@ -526,7 +508,6 @@ sub command_line_setup () {
              'start-from=s'             => \$opt_start_from,
              'suite|suites=s'           => \$opt_suites,
              'skip-rpl'                 => \$opt_skip_rpl,
-             'skip-im'                  => \$opt_skip_im,
              'skip-test=s'              => \$opt_skip_test,
              'big-test'                 => \$opt_big_test,
 
@@ -535,9 +516,6 @@ sub command_line_setup () {
              'slave_port=i'             => \$opt_slave_myport,
              'ndbcluster-port|ndbcluster_port=i' => \$opt_ndbcluster_port,
              'ndbcluster-port-slave=i'  => \$opt_ndbcluster_port_slave,
-             'im-port=i'                => \$im_port, # Instance Manager port.
-             'im-mysqld1-port=i'        => \$im_mysqld1_port, # Port of mysqld, controlled by IM
-             'im-mysqld2-port=i'        => \$im_mysqld2_port, # Port of mysqld, controlled by IM
 	     'mtr-build-thread=i'       => \$opt_mtr_build_thread,
 
              # Test case authoring
@@ -893,27 +871,8 @@ sub command_line_setup () {
   $opt_tmpdir =~ s,/+$,,;       # Remove ending slash if any
 
   # --------------------------------------------------------------------------
-  # Check im suport
-  # --------------------------------------------------------------------------
-  if ($opt_extern)
-  {
-    mtr_report("Disable instance manager when running with extern mysqld");
-    $opt_skip_im= 1;
-  }
-  elsif ( $mysql_version_id < 50000 )
-  {
-      # Instance manager is not supported until 5.0
-      $opt_skip_im= 1;
-    }
-  elsif ( $glob_win32 )
-  {
-    mtr_report("Disable Instance manager - testing not supported on Windows");
-      $opt_skip_im= 1;
-    }
-
-  # --------------------------------------------------------------------------
-  # Record flag
-  # --------------------------------------------------------------------------
+# Record flag
+# --------------------------------------------------------------------------
   if ( $opt_record and ! @opt_cases )
   {
     mtr_error("Will not run in record mode without a specific test case");
@@ -1127,44 +1086,6 @@ sub command_line_setup () {
    start_opts    => [],
   };
 
-  $instance_manager=
-  {
-   path_err =>        "$opt_vardir/log/im.err",
-   path_log =>        "$opt_vardir/log/im.log",
-   path_pid =>        "$opt_vardir/run/im.pid",
-   path_angel_pid =>  "$opt_vardir/run/im.angel.pid",
-   path_sock =>       "$sockdir/im.sock",
-   port =>             $im_port,
-   start_timeout =>    $master->[0]->{'start_timeout'},
-   admin_login =>     'im_admin',
-   admin_password =>  'im_admin_secret',
-   admin_sha1 =>      '*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295',
-   password_file =>   "$opt_vardir/im.passwd",
-   defaults_file =>   "$opt_vardir/im.cnf",
-  };
-
-  $instance_manager->{'instances'}->[0]=
-  {
-   server_id    => 1,
-   port         => $im_mysqld1_port,
-   path_datadir => "$opt_vardir/im_mysqld_1.data",
-   path_sock    => "$sockdir/mysqld_1.sock",
-   path_pid     => "$opt_vardir/run/mysqld_1.pid",
-   start_timeout  => 400, # enough time create innodb tables
-   old_log_format => 1
-  };
-
-  $instance_manager->{'instances'}->[1]=
-  {
-   server_id    => 2,
-   port         => $im_mysqld2_port,
-   path_datadir => "$opt_vardir/im_mysqld_2.data",
-   path_sock    => "$sockdir/mysqld_2.sock",
-   path_pid     => "$opt_vardir/run/mysqld_2.pid",
-   nonguarded   => 1,
-   start_timeout  => 400, # enough time create innodb tables
-   old_log_format => 1
-  };
 
   my $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port";
   $clusters->[0]=
@@ -1310,9 +1231,6 @@ sub set_mtr_build_thread_ports($) {
   $opt_slave_myport=          $opt_master_myport + 2;  # and 3 4
   $opt_ndbcluster_port=       $opt_master_myport + 5;
   $opt_ndbcluster_port_slave= $opt_master_myport + 6;
-  $im_port=                   $opt_master_myport + 7;
-  $im_mysqld1_port=           $opt_master_myport + 8;
-  $im_mysqld2_port=           $opt_master_myport + 9;
 
   if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
   {
@@ -1335,14 +1253,6 @@ sub datadir_list_setup () {
   {
     push(@data_dir_lst, $slave->[$idx]->{'path_myddir'});
   }
-
-  unless ($opt_skip_im)
-  {
-    foreach my $instance (@{$instance_manager->{'instances'}})
-    {
-      push(@data_dir_lst, $instance->{'path_datadir'});
-    }
-  }
 }
 
 
@@ -1462,18 +1372,6 @@ sub collect_mysqld_features_from_running
   }
 }
 
-sub executable_setup_im () {
-
-  # Look for instance manager binary - mysqlmanager
-  $exe_im=
-    mtr_exe_maybe_exists(
-      "$glob_basedir/server-tools/instance-manager/mysqlmanager",
-      "$glob_basedir/libexec/mysqlmanager",
-      "$glob_basedir/bin/mysqlmanager",
-      "$glob_basedir/sbin/mysqlmanager");
-
-  return ($exe_im eq "");
-}
 
 sub executable_setup_ndb () {
 
@@ -1601,13 +1499,6 @@ sub executable_setup () {
       }
     }
 
-    if ( ! $opt_skip_im and executable_setup_im())
-    {
-      mtr_warning("Could not find all required instance manager binaries, " .
-  		"all im tests will fail, use --skip-im to " .
-  		"continue without instance manager");
-      $instance_manager->{"executable_setup_failed"}= 1;
-    }
 
     # Look for the udf_example library
     $lib_udf_example=
@@ -1851,9 +1742,6 @@ sub environment_setup () {
   $ENV{'SLAVE_MYPORT2'}=      $slave->[2]->{'port'};
   $ENV{'MYSQL_TCP_PORT'}=     $mysqld_variables{'port'};
 
-  $ENV{'IM_PATH_SOCK'}=       $instance_manager->{path_sock};
-  $ENV{'IM_USERNAME'}=        $instance_manager->{admin_login};
-  $ENV{'IM_PASSWORD'}=        $instance_manager->{admin_password};
   $ENV{MTR_BUILD_THREAD}=      $opt_mtr_build_thread;
 
   $ENV{'EXE_MYSQL'}=          $exe_mysql;
@@ -1884,35 +1772,9 @@ sub environment_setup () {
     $ENV{'NDB_EXAMPLES_OUTPUT'}=      $path_ndb_testrun_log;
   }
 
-  # ----------------------------------------------------
-  # Setup env for IM
-  # ----------------------------------------------------
-  if ( ! $opt_skip_im )
-  {
-    $ENV{'IM_EXE'}=             $exe_im;
-    $ENV{'IM_PATH_PID'}=        $instance_manager->{path_pid};
-    $ENV{'IM_PATH_ANGEL_PID'}=  $instance_manager->{path_angel_pid};
-    $ENV{'IM_PORT'}=            $instance_manager->{port};
-    $ENV{'IM_DEFAULTS_PATH'}=   $instance_manager->{defaults_file};
-    $ENV{'IM_PASSWORD_PATH'}=   $instance_manager->{password_file};
-
-    $ENV{'IM_MYSQLD1_SOCK'}=
-      $instance_manager->{instances}->[0]->{path_sock};
-    $ENV{'IM_MYSQLD1_PORT'}=
-      $instance_manager->{instances}->[0]->{port};
-    $ENV{'IM_MYSQLD1_PATH_PID'}=
-      $instance_manager->{instances}->[0]->{path_pid};
-    $ENV{'IM_MYSQLD2_SOCK'}=
-      $instance_manager->{instances}->[1]->{path_sock};
-    $ENV{'IM_MYSQLD2_PORT'}=
-      $instance_manager->{instances}->[1]->{port};
-    $ENV{'IM_MYSQLD2_PATH_PID'}=
-      $instance_manager->{instances}->[1]->{path_pid};
-  }
-
-  # ----------------------------------------------------
-  # Setup env so childs can execute mysqlcheck
-  # ----------------------------------------------------
+# ---------------------------------------------------- Setup env so childs
+# can execute mysqlcheck
+# ----------------------------------------------------
   my $cmdline_mysqlcheck=
     mtr_native_path($exe_mysqlcheck) .
     " --no-defaults --debug-check -uroot " .
@@ -2109,12 +1971,6 @@ sub environment_setup () {
 	print "Using NDBCLUSTER_PORT_SLAVE = $ENV{NDBCLUSTER_PORT_SLAVE}\n";
       }
     }
-    if ( ! $opt_skip_im )
-    {
-      print "Using IM_PORT               = $ENV{IM_PORT}\n";
-      print "Using IM_MYSQLD1_PORT       = $ENV{IM_MYSQLD1_PORT}\n";
-      print "Using IM_MYSQLD2_PORT       = $ENV{IM_MYSQLD2_PORT}\n";
-    }
   }
 
   # Create an environment variable to make it possible
@@ -2932,11 +2788,6 @@ sub mysql_install_db () {
     copy_install_db("slave".($idx+1), $slave->[$idx]->{'path_myddir'});
   }
 
-  if ( ! $opt_skip_im )
-  {
-    im_prepare_env($instance_manager);
-  }
-
   my $cluster_started_ok= 1; # Assume it can be started
 
   my $cluster= $clusters->[0]; # Master cluster
@@ -3105,105 +2956,6 @@ sub install_db ($$) {
 }
 
 
-sub im_prepare_env($) {
-  my $instance_manager = shift;
-
-  im_create_passwd_file($instance_manager);
-  im_prepare_data_dir($instance_manager);
-}
-
-
-sub im_create_passwd_file($) {
-  my $instance_manager = shift;
-
-  my $pwd_file_path = $instance_manager->{'password_file'};
-
-  mtr_report("Creating IM password file ($pwd_file_path)");
-
-  open(OUT, ">", $pwd_file_path)
-    or mtr_error("Can't write to $pwd_file_path: $!");
-
-  print OUT $instance_manager->{'admin_login'}, ":",
-        $instance_manager->{'admin_sha1'}, "\n";
-
-  close(OUT);
-}
-
-
-sub im_create_defaults_file($) {
-  my $instance_manager = shift;
-
-  my $defaults_file = $instance_manager->{'defaults_file'};
-
-  open(OUT, ">", $defaults_file)
-    or mtr_error("Can't write to $defaults_file: $!");
-
-  print OUT <<EOF
-[mysql]
-
-[manager]
-pid-file            = $instance_manager->{path_pid}
-angel-pid-file      = $instance_manager->{path_angel_pid}
-socket              = $instance_manager->{path_sock}
-port                = $instance_manager->{port}
-password-file       = $instance_manager->{password_file}
-default-mysqld-path = $exe_mysqld
-
-EOF
-;
-
-  foreach my $instance (@{$instance_manager->{'instances'}})
-  {
-    my $server_id = $instance->{'server_id'};
-
-    print OUT <<EOF
-[mysqld$server_id]
-socket              = $instance->{path_sock}
-pid-file            = $instance->{path_pid}
-port                = $instance->{port}
-datadir             = $instance->{path_datadir}
-log                 = $instance->{path_datadir}/mysqld$server_id.log
-log-error           = $instance->{path_datadir}/mysqld$server_id.err.log
-log-slow-queries    = $instance->{path_datadir}/mysqld$server_id.slow.log
-language            = $path_language
-character-sets-dir  = $path_charsetsdir
-basedir             = $path_my_basedir
-server_id           = $server_id
-shutdown-delay      = 10
-skip-stack-trace
-loose-skip-innodb
-loose-skip-ndbcluster
-EOF
-;
-    if ( $mysql_version_id < 50100 )
-    {
-      print OUT "skip-bdb\n";
-    }
-    print OUT "nonguarded\n" if $instance->{'nonguarded'};
-    if ( $mysql_version_id >= 50100 )
-    {
-      print OUT "log-output=FILE\n" if $instance->{'old_log_format'};
-    }
-    print OUT "\n";
-  }
-
-  close(OUT);
-}
-
-
-sub im_prepare_data_dir($) {
-  my $instance_manager = shift;
-
-  foreach my $instance (@{$instance_manager->{'instances'}})
-  {
-    copy_install_db(
-      'im_mysqld_' . $instance->{'server_id'},
-      $instance->{'path_datadir'});
-  }
-}
-
-
-
 #
 # Restore snapshot of the installed slave databases
 # if the snapshot exists
@@ -3279,19 +3031,6 @@ sub run_testcase_check_skip_test($)
     }
   }
 
-  if ( $tinfo->{'component_id'} eq 'im' )
-  {
-      # If test needs im, check binaries was found ok
-    if ( $instance_manager->{'executable_setup_failed'} )
-    {
-      mtr_report_test_name($tinfo);
-      $tinfo->{comment}=
-	"Failed to find MySQL manager binaries";
-      mtr_report_test_failed($tinfo);
-      return 1;
-    }
-  }
-
   return 0;
 }
 
@@ -3349,12 +3088,6 @@ sub run_testcase_mark_logs($$)
     mtr_tofile($mysqld->{path_myerr}, $log_msg);
   }
 
-  if ( $tinfo->{'component_id'} eq 'im')
-  {
-    mtr_tofile($instance_manager->{path_err}, $log_msg);
-    mtr_tofile($instance_manager->{path_log}, $log_msg);
-  }
-
   # ndbcluster log file
   mtr_tofile($path_ndb_testrun_log, $log_msg);
 
@@ -3507,11 +3240,6 @@ sub run_testcase ($) {
   # ----------------------------------------------------------------------
   # Stop Instance Manager if we are processing an IM-test case.
   # ----------------------------------------------------------------------
-  if ( $tinfo->{'component_id'} eq 'im' and
-       !mtr_im_stop($instance_manager, $tinfo->{'name'}))
-  {
-    mtr_error("Failed to stop Instance Manager.")
-  }
 }
 
 
@@ -4081,15 +3809,6 @@ sub stop_all_servers () {
 
   mtr_report("Stopping All Servers");
 
-  if ( ! $opt_skip_im )
-  {
-    mtr_report("Shutting-down Instance Manager");
-    unless (mtr_im_stop($instance_manager, "stop_all_servers"))
-    {
-      mtr_error("Failed to stop Instance Manager.")
-    }
-  }
-
   my %admin_pids; # hash of admin processes that requests shutdown
   my @kill_pids;  # list of processes to shutdown/kill
   my $pid;
@@ -4485,21 +4204,6 @@ sub run_testcase_start_servers($) {
     # Save this test case information, so next can examine it
     $master->[0]->{'running_master_options'}= $tinfo;
   }
-  elsif ( ! $opt_skip_im and $tinfo->{'component_id'} eq 'im' )
-  {
-    # We have to create defaults file every time, in order to ensure that it
-    # will be the same for each test. The problem is that test can change the
-    # file (by SET/UNSET commands), so w/o recreating the file, execution of
-    # one test can affect the other.
-
-    im_create_defaults_file($instance_manager);
-
-    if  ( ! mtr_im_start($instance_manager, $tinfo->{im_opts}) )
-    {
-      $tinfo->{'comment'}= "Failed to start Instance Manager. ";
-      return 1;
-    }
-  }
 
   # ----------------------------------------------------------------------
   # Start slaves - if needed
@@ -4676,14 +4380,7 @@ sub run_mysqltest ($) {
   mtr_add_arg($args, "--mark-progress")
     if $opt_mark_progress;
 
-  if ($tinfo->{'component_id'} eq 'im')
-  {
-    mtr_add_arg($args, "--socket=%s", $instance_manager->{'path_sock'});
-    mtr_add_arg($args, "--port=%d", $instance_manager->{'port'});
-    mtr_add_arg($args, "--user=%s", $instance_manager->{'admin_login'});
-    mtr_add_arg($args, "--password=%s", $instance_manager->{'admin_password'});
-  }
-  else # component_id == mysqld
+
   {
     mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
     mtr_add_arg($args, "--port=%d", $master->[0]->{'port'});
diff -Nrup a/mysql-test/suite/im/r/im_cmd_line.result b/mysql-test/suite/im/r/im_cmd_line.result
--- a/mysql-test/suite/im/r/im_cmd_line.result	2007-08-29 18:34:51 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,47 +0,0 @@
-SHOW VARIABLES LIKE 'server_id';
-Variable_name	Value
-server_id	1
-SHOW INSTANCES;
-instance_name	state
-mysqld1	XXXXX
-mysqld2	offline
---> Listing users...
-im_admin
-
-==> Adding user 'testuser'...
-
---> IM password file:
-testuser:*0D3CED9BEC10A777AEC23CCC353A8C08A633045E
-im_admin:*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295
---> EOF
-
---> Printing out line for 'testuser'...
-testuser:*0D3CED9BEC10A777AEC23CCC353A8C08A633045E
-
---> Listing users...
-im_admin
-testuser
-
-==> Changing the password of 'testuser'...
-
---> IM password file:
-im_admin:*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295
-testuser:*39C549BDECFBA8AFC3CE6B948C9359A0ECE08DE2
---> EOF
-
---> Printing out line for 'testuser'...
-testuser:*39C549BDECFBA8AFC3CE6B948C9359A0ECE08DE2
-
---> Listing users...
-testuser
-im_admin
-
-==> Dropping user 'testuser'...
-
---> IM password file:
-im_admin:*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295
---> EOF
-
---> Listing users...
-im_admin
-
diff -Nrup a/mysql-test/suite/im/r/im_daemon_life_cycle.result b/mysql-test/suite/im/r/im_daemon_life_cycle.result
--- a/mysql-test/suite/im/r/im_daemon_life_cycle.result	2007-08-29 18:34:51 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,26 +0,0 @@
-SHOW VARIABLES LIKE 'server_id';
-Variable_name	Value
-server_id	1
-SHOW INSTANCES;
-instance_name	state
-mysqld1	XXXXX
-mysqld2	offline
-Killing the process...
-Waiting...
-Success: the process was restarted.
-Success: server is ready to accept connection on socket.
-
---------------------------------------------------------------------
--- Test for BUG#12751
---------------------------------------------------------------------
-START INSTANCE mysqld2;
-Success: the process has been started.
-Killing the process...
-Waiting...
-Success: the process was restarted.
-Success: server is ready to accept connection on socket.
-SHOW INSTANCE STATUS mysqld1;
-instance_name	state	version_number	version	mysqld_compatible
-mysqld1	STATE	VERSION_NUMBER	VERSION	no
-STOP INSTANCE mysqld2;
-Success: the process has been stopped.
diff -Nrup a/mysql-test/suite/im/r/im_instance_conf.result b/mysql-test/suite/im/r/im_instance_conf.result
--- a/mysql-test/suite/im/r/im_instance_conf.result	2007-08-29 18:34:51 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,225 +0,0 @@
-SHOW VARIABLES LIKE 'server_id';
-Variable_name	Value
-server_id	1
-SHOW INSTANCES;
-instance_name	state
-mysqld1	XXXXX
-mysqld2	offline
---------------------------------------------------------------------
-server_id           = 1
-server_id           = 2
---------------------------------------------------------------------
-CREATE INSTANCE mysqld3
-server_id = 3,
-socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld3	offline
-mysqld2	offline
-mysqld1	online
---------------------------------------------------------------------
-server_id           = 1
-server_id           = 2
-server_id=3
---------------------------------------------------------------------
-CREATE INSTANCE mysqld1;
-ERROR HY000: Instance already exists
-CREATE INSTANCE mysqld2;
-ERROR HY000: Instance already exists
-CREATE INSTANCE mysqld3;
-ERROR HY000: Instance already exists
---------------------------------------------------------------------
-nonguarded
---------------------------------------------------------------------
-CREATE INSTANCE mysqld4
-nonguarded,
-server_id = 4,
-socket = "$MYSQL_TMP_DIR/mysqld_4.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld3	offline
-mysqld4	offline
-mysqld1	online
-mysqld2	offline
---------------------------------------------------------------------
-nonguarded
-nonguarded
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-CREATE INSTANCE mysqld5
-test-A = 000,
-test-B = test,
-server_id = 5,
-socket = "$MYSQL_TMP_DIR/mysqld_5.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld4	offline
-mysqld5	offline
-mysqld2	offline
-mysqld3	offline
---------------------------------------------------------------------
-test-A=000
---------------------------------------------------------------------
-test-B=test
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-CREATE INSTANCE mysqld6
-test-C1  =  10  ,
-test-C2  =  02  ,
-server_id = 6,
-socket = "$MYSQL_TMP_DIR/mysqld_6.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld2	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
---------------------------------------------------------------------
-test-C1=10
---------------------------------------------------------------------
-test-C2=02
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-CREATE INSTANCE mysqld7  test-D  =  test-D-value  ;
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld2	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
-CREATE INSTANCE mysqld8  test-E  0  ;
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld2	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
-CREATE INSTANCE mysqld8  test-F  =  ;
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld2	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-CREATE INSTANCE mysqld9
-test-1=" hello world ",
-test-2='  ',
-server_id = 9,
-socket = "$MYSQL_TMP_DIR/mysqld_9.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld2	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
-mysqld9	offline
-CREATE INSTANCE mysqld10
-test-3='\b\babc\sdef',
-server_id = 10,
-socket = "$MYSQL_TMP_DIR/mysqld_10.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld9	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
-mysqld10	offline
-mysqld2	offline
-CREATE INSTANCE mysqld11
-test-4='abc\tdef',
-test-5='abc\ndef',
-server_id = 11,
-socket = "$MYSQL_TMP_DIR/mysqld_11.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld11	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
-mysqld10	offline
-mysqld2	offline
-mysqld9	offline
-CREATE INSTANCE mysqld12
-test-6="abc\rdef",
-test-7="abc\\def",
-server_id = 12,
-socket = "$MYSQL_TMP_DIR/mysqld_12.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld9	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
-mysqld10	offline
-mysqld2	offline
-mysqld12	offline
-mysqld11	offline
-CREATE INSTANCE mysqld13 test-bad=' \ ';
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld9	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
-mysqld10	offline
-mysqld2	offline
-mysqld12	offline
-mysqld11	offline
---------------------------------------------------------------------
-test-1= hello world 
---------------------------------------------------------------------
-test-2=  
---------------------------------------------------------------------
-test-3=abc def
---------------------------------------------------------------------
-test-4=abc	def
---------------------------------------------------------------------
-test-5=abc
---------------------------------------------------------------------
-test-6=abc
def
---------------------------------------------------------------------
-test-7=abc\def
---------------------------------------------------------------------
---------------------------------------------------------------------
-CREATE INSTANCE qqq1;
-ERROR HY000: Malformed instance name.
diff -Nrup a/mysql-test/suite/im/r/im_life_cycle.result b/mysql-test/suite/im/r/im_life_cycle.result
--- a/mysql-test/suite/im/r/im_life_cycle.result	2007-08-29 18:34:51 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,73 +0,0 @@
-SHOW VARIABLES LIKE 'server_id';
-Variable_name	Value
-server_id	1
-SHOW INSTANCES;
-instance_name	state
-mysqld1	XXXXX
-mysqld2	offline
-
---------------------------------------------------------------------
--- 1.1.2.
---------------------------------------------------------------------
-START INSTANCE mysqld2;
-Success: the process has been started.
-SHOW VARIABLES LIKE 'port';
-Variable_name	Value
-port	IM_MYSQLD2_PORT
-
---------------------------------------------------------------------
--- 1.1.3.
---------------------------------------------------------------------
-STOP INSTANCE mysqld2;
-Success: the process has been stopped.
-
---------------------------------------------------------------------
--- 1.1.4.
---------------------------------------------------------------------
-START INSTANCE mysqld3;
-ERROR HY000: Unknown instance name
-START INSTANCE mysqld1;
-ERROR HY000: The instance is already started
-
---------------------------------------------------------------------
--- 1.1.5.
---------------------------------------------------------------------
-STOP INSTANCE mysqld3;
-ERROR HY000: Unknown instance name
-
---------------------------------------------------------------------
--- 1.1.6.
---------------------------------------------------------------------
-Killing the process...
-Waiting...
-Success: the process was restarted.
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld2	offline
-
---------------------------------------------------------------------
--- 1.1.7.
---------------------------------------------------------------------
-START INSTANCE mysqld2;
-Success: the process has been started.
-Killing the process...
-Waiting...
-Success: the process was killed.
-
---------------------------------------------------------------------
--- 1.1.8.
---------------------------------------------------------------------
-SHOW INSTANCE STATUS;
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-
---------------------------------------------------------------------
--- BUG#12813
---------------------------------------------------------------------
-START INSTANCE mysqld1,mysqld2,mysqld3;
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-STOP INSTANCE mysqld1,mysqld2,mysqld3;
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-STOP INSTANCE mysqld2;
-ERROR HY000: Cannot stop instance. Perhaps the instance is not started, or was started manually, so IM cannot find the pidfile.
-End of 5.0 tests
diff -Nrup a/mysql-test/suite/im/r/im_options.result b/mysql-test/suite/im/r/im_options.result
--- a/mysql-test/suite/im/r/im_options.result	2007-08-29 18:34:51 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,151 +0,0 @@
-SHOW VARIABLES LIKE 'server_id';
-Variable_name	Value
-server_id	1
-SHOW INSTANCES;
-instance_name	state
-mysqld1	XXXXX
-mysqld2	offline
-UNSET mysqld1.server_id;
-ERROR HY000: The instance is active. Stop the instance first
-SET mysqld1.server_id = 11;
-ERROR HY000: The instance is active. Stop the instance first
-CREATE INSTANCE mysqld3
-datadir = '/',
-server_id = 3,
-socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
-START INSTANCE mysqld3;
-UNSET mysqld3.server_id;
-ERROR HY000: The instance is active. Stop the instance first
-SET mysqld3.server_id = 11;
-ERROR HY000: The instance is active. Stop the instance first
-STOP INSTANCE mysqld3;
-SHOW INSTANCE STATUS mysqld3;
-instance_name	state	version_number	version	mysqld_compatible
-mysqld3	offline	VERSION_NUMBER	VERSION	no
-UNSET mysqld2.server_id;
-UNSET mysqld2.server_id;
-SHOW INSTANCE OPTIONS mysqld2;
-option_name	value
-instance_name	option_value
-socket	option_value
-pid-file	option_value
-port	option_value
-datadir	option_value
-log	option_value
-log-error	option_value
-log-slow-queries	option_value
-language	option_value
-character-sets-dir	option_value
-basedir	option_value
-shutdown-delay	option_value
-skip-stack-trace	option_value
-loose-skip-innodb	option_value
-loose-skip-ndbcluster	option_value
-nonguarded	option_value
-log-output	option_value
-SET mysqld2.server_id = 2;
-SET mysqld2.server_id = 2;
-SHOW INSTANCE OPTIONS mysqld2;
-option_name	value
-instance_name	option_value
-socket	option_value
-pid-file	option_value
-port	option_value
-datadir	option_value
-log	option_value
-log-error	option_value
-log-slow-queries	option_value
-language	option_value
-character-sets-dir	option_value
-basedir	option_value
-shutdown-delay	option_value
-skip-stack-trace	option_value
-loose-skip-innodb	option_value
-loose-skip-ndbcluster	option_value
-nonguarded	option_value
-log-output	option_value
-server_id	option_value
-UNSET mysqld2.server_id = 11;
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-SET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc = 0010, mysqld3.ddd = 0020;
---------------------------------------------------------------------
-aaa
---------------------------------------------------------------------
-bbb
---------------------------------------------------------------------
-ccc=0010
---------------------------------------------------------------------
-ddd=0020
---------------------------------------------------------------------
-UNSET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc, mysqld3.ddd;
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-SET mysqld2.aaa, mysqld3.bbb, mysqld.ccc = 0010;
-ERROR HY000: Unknown instance name
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-SET mysqld2.aaa, mysqld3.bbb, mysqld1.ccc = 0010;
-ERROR HY000: The instance is active. Stop the instance first
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-UNSET mysqld2.server_id, mysqld3.server_id, mysqld.ccc;
-ERROR HY000: Unknown instance name
---------------------------------------------------------------------
-server_id           = 1
-server_id=2
-server_id=3
---------------------------------------------------------------------
-UNSET mysqld2.server_id, mysqld3.server_id, mysqld1.ccc;
-ERROR HY000: The instance is active. Stop the instance first
---------------------------------------------------------------------
-server_id           = 1
-server_id=2
-server_id=3
---------------------------------------------------------------------
-DROP INSTANCE mysqld3;
-SET mysqld2.server_id=222;
-SET mysqld2.server_id = 222;
-SET   mysqld2.server_id   =  222  ;
-SET   mysqld2  .  server_id  =  222  ;
-SET   mysqld2  .  server_id  =  222  , mysqld2  .  aaa  , mysqld2  .  bbb  ;
---------------------------------------------------------------------
-server_id           = 1
-server_id=222
---------------------------------------------------------------------
-aaa
---------------------------------------------------------------------
-bbb
---------------------------------------------------------------------
-UNSET mysqld2  . aaa  ,  mysqld2  .  bbb ;
---------------------------------------------------------------------
-server_id           = 1
-server_id=222
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-server_id           = 1
-server_id=222
---------------------------------------------------------------------
-SHOW VARIABLES LIKE 'server_id';
-Variable_name	Value
-server_id	1
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld2	offline
-FLUSH INSTANCES;
-ERROR HY000: At least one instance is active. Stop all instances first
-STOP INSTANCE mysqld1;
-SHOW INSTANCES;
-instance_name	state
-mysqld1	offline
-mysqld2	offline
-FLUSH INSTANCES;
diff -Nrup a/mysql-test/suite/im/r/im_utils.result b/mysql-test/suite/im/r/im_utils.result
--- a/mysql-test/suite/im/r/im_utils.result	2007-08-29 18:34:51 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,96 +0,0 @@
-SHOW VARIABLES LIKE 'server_id';
-Variable_name	Value
-server_id	1
-SHOW INSTANCES;
-instance_name	state
-mysqld1	XXXXX
-mysqld2	offline
-SHOW INSTANCE OPTIONS mysqld1;
-option_name	value
-instance_name	VALUE
-socket	VALUE
-pid-file	VALUE
-port	VALUE
-datadir	VALUE
-log	VALUE
-log-error	VALUE
-log-slow-queries	VALUE
-language	VALUE
-character-sets-dir	VALUE
-basedir	VALUE
-server_id	VALUE
-shutdown-delay	VALUE
-skip-stack-trace	VALUE
-loose-skip-innodb	VALUE
-loose-skip-ndbcluster	VALUE
-log-output	VALUE
-SHOW INSTANCE OPTIONS mysqld2;
-option_name	value
-instance_name	VALUE
-socket	VALUE
-pid-file	VALUE
-port	VALUE
-datadir	VALUE
-log	VALUE
-log-error	VALUE
-log-slow-queries	VALUE
-language	VALUE
-character-sets-dir	VALUE
-basedir	VALUE
-server_id	VALUE
-shutdown-delay	VALUE
-skip-stack-trace	VALUE
-loose-skip-innodb	VALUE
-loose-skip-ndbcluster	VALUE
-nonguarded	VALUE
-log-output	VALUE
-START INSTANCE mysqld2;
-Success: the process has been started.
-STOP INSTANCE mysqld2;
-Success: the process has been stopped.
-SHOW mysqld1 LOG FILES;
-Logfile	Path	File size
-ERROR LOG	PATH	FILE_SIZE
-GENERAL LOG	PATH	FILE_SIZE
-SLOW LOG	PATH	FILE_SIZE
-SHOW mysqld2 LOG FILES;
-Logfile	Path	File size
-ERROR LOG	PATH	FILE_SIZE
-GENERAL LOG	PATH	FILE_SIZE
-SLOW LOG	PATH	FILE_SIZE
-SHOW mysqld1 LOG ERROR 10;
-Log
-LOG_DATA
-SHOW mysqld1 LOG SLOW 10;
-Log
-LOG_DATA
-SHOW mysqld1 LOG GENERAL 10;
-Log
-LOG_DATA
-SHOW mysqld1 LOG ERROR 10, 2;
-Log
-LOG_DATA
-SHOW mysqld1 LOG SLOW 10, 2;
-Log
-LOG_DATA
-SHOW mysqld1 LOG GENERAL 10, 2;
-Log
-LOG_DATA
-SHOW mysqld2 LOG ERROR 10;
-Log
-LOG_DATA
-SHOW mysqld2 LOG SLOW 10;
-Log
-LOG_DATA
-SHOW mysqld2 LOG GENERAL 10;
-Log
-LOG_DATA
-SHOW mysqld2 LOG ERROR 10, 2;
-Log
-LOG_DATA
-SHOW mysqld2 LOG SLOW 10, 2;
-Log
-LOG_DATA
-SHOW mysqld2 LOG GENERAL 10, 2;
-Log
-LOG_DATA
diff -Nrup a/mysql-test/suite/im/t/disabled.def b/mysql-test/suite/im/t/disabled.def
--- a/mysql-test/suite/im/t/disabled.def	2007-08-29 21:02:31 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,20 +0,0 @@
-##############################################################################
-#
-#  List the test cases that are to be disabled temporarily.
-#
-#  Separate the test case name and the comment with ':'.
-#
-#    <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
-#
-#  Do not use any TAB characters for whitespace.
-#
-##############################################################################
-im_options               : Bug#20294 2006-07-24 stewart   Instance manager test im_options fails randomly
-im_daemon_life_cycle     : Bug#20294 2007-05-14 alik      Instance manager tests fail randomly
-im_cmd_line              : Bug#20294 2007-05-14 alik      Instance manager tests fail randomly
-im_utils                 : Bug#20294 2007-05-30 alik      Instance manager tests fail randomly
-im_instance_conf         : Bug#20294 2007-05-30 alik      Instance manager tests fail randomly
-im_life_cycle            : BUG#27851 Instance manager dies on ASSERT in ~Thread_registry() or from not being able to close a mysqld instance.
-im_instance_conf         : BUG#28743 Instance manager generates warnings in test suite
-im_utils                 : BUG#28743 Instance manager generates warnings in test suite
-
diff -Nrup a/mysql-test/suite/im/t/im_check_env.inc b/mysql-test/suite/im/t/im_check_env.inc
--- a/mysql-test/suite/im/t/im_check_env.inc	2007-08-29 20:18:05 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,26 +0,0 @@
-# This file is intended to be used in each IM-test. It contains stamements,
-# that ensure that starting conditions (environment) for the IM-test are as
-# expected.
-
-# Check the running instances.
-
---connect (mysql1_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
-
---connection mysql1_con
-
-SHOW VARIABLES LIKE 'server_id';
-
---source include/not_windows.inc
-
---connection default
-
-# Let IM detect that mysqld1 is online. This delay should be longer than
-# monitoring interval.
-
---sleep 2
-
-# Check that IM understands that mysqld1 is online, while mysqld2 is
-# offline.
-
---replace_result starting XXXXX online XXXXX
-SHOW INSTANCES;
diff -Nrup a/mysql-test/suite/im/t/im_cmd_line.imtest b/mysql-test/suite/im/t/im_cmd_line.imtest
--- a/mysql-test/suite/im/t/im_cmd_line.imtest	2007-08-29 21:02:31 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,68 +0,0 @@
-###########################################################################
-#
-# Tests for user-management command-line options.
-#
-###########################################################################
-
---source suite/im/t/im_check_env.inc
-
-###########################################################################
-
-# List users so we are sure about starting conditions.
-
---echo --> Listing users...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --list-users 2>&1 >/dev/null
---echo
-
-# Add a new user.
-
---echo ==> Adding user 'testuser'...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --add-user --username=testuser --password=abc 2>&1 >/dev/null
---echo
-
---echo --> IM password file:
---exec cat $IM_PASSWORD_PATH
---echo --> EOF
---echo
-
---echo --> Printing out line for 'testuser'...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --print-password-line --username=testuser --password=abc | tail -2 | head -1
---echo
-
---echo --> Listing users...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --list-users 2>&1 >/dev/null
---echo
-
-# Edit user's attributes.
-
---echo ==> Changing the password of 'testuser'...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --edit-user --username=testuser --password=xyz 2>&1 >/dev/null
---echo
-
---echo --> IM password file:
---exec cat $IM_PASSWORD_PATH
---echo --> EOF
---echo
-
---echo --> Printing out line for 'testuser'...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --print-password-line --username=testuser --password=xyz | tail -2 | head -1
---echo
-
---echo --> Listing users...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --list-users 2>&1 >/dev/null
---echo
-
-# Drop user.
-
---echo ==> Dropping user 'testuser'...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --drop-user --username=testuser 2>&1 >/dev/null
---echo
-
---echo --> IM password file:
---exec cat $IM_PASSWORD_PATH
---echo --> EOF
---echo
-
---echo --> Listing users...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --list-users 2>&1 >/dev/null
---echo
diff -Nrup a/mysql-test/suite/im/t/im_daemon_life_cycle-im.opt b/mysql-test/suite/im/t/im_daemon_life_cycle-im.opt
--- a/mysql-test/suite/im/t/im_daemon_life_cycle-im.opt	2007-08-29 18:34:27 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,3 +0,0 @@
---run-as-service
---log=$MYSQLTEST_VARDIR/log/im.log
---monitoring-interval=1
diff -Nrup a/mysql-test/suite/im/t/im_daemon_life_cycle.imtest b/mysql-test/suite/im/t/im_daemon_life_cycle.imtest
--- a/mysql-test/suite/im/t/im_daemon_life_cycle.imtest	2007-08-29 21:02:31 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,100 +0,0 @@
-let $UTIL=$MYSQL_TEST_DIR/suite/im/t;
-
-###########################################################################
-#
-# This file contains test for (1.2) test suite.
-#
-# Consult WL#2789 for more information.
-#
-###########################################################################
-
---exec $UTIL/log.sh im_daemon_life_cycle im_daemon_life_cycle.imtest started.
-
-###########################################################################
-
---source suite/im/t/im_check_env.inc
-
-# Turn on reconnect, not on by default anymore.
---enable_reconnect
-
-###########################################################################
-#
-# The main daemon-life-cycle test case -- check that IM-angel will restart
-# IM-main if it got killed:
-#   - kill IM-main and check that IM-angel will restart it;
-#   - wait for IM-main to start accepting connections before continue test
-#     case;
-#
-# NOTE: timeout is 55 seconds. Timeout should be more than shutdown-delay
-# specified for managed MySQL instance. Now shutdown-delay is 10 seconds
-# (set in mysql-test-run.pl). So, 55 seconds should be enough to make 5
-# attempts.
-#
-###########################################################################
-
---exec $UTIL/log.sh im_daemon_life_cycle Main-test: starting...
-
---exec $UTIL/log.sh im_daemon_life_cycle Killing IM-main...
---exec $UTIL/kill_n_check.sh $IM_PATH_PID restarted 55 im_daemon_life_cycle
-
---exec $UTIL/log.sh im_daemon_life_cycle Waiting for IM-main to start accepting connections...
---exec $UTIL/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 55 im_daemon_life_cycle
-
---exec $UTIL/log.sh im_daemon_life_cycle Main-test: done.
-
-###########################################################################
-#
-# BUG#12751: Instance Manager: client hangs
-#   - start nonguarded instance (mysqld2);
-#   - kill IM-main and get it restarted by IM-angel;
-#   - check that guarded instance (mysqld1) is accepting connections.
-#   - check that non-guarded instance (mysqld2) were not stopped.
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- Test for BUG#12751
---echo --------------------------------------------------------------------
-
---exec $UTIL/log.sh im_daemon_life_cycle BUG12751: starting...
-
-# 1. Start mysqld;
-
---exec $UTIL/log.sh im_daemon_life_cycle mysqld2: starting...
-START INSTANCE mysqld2;
-
---exec $UTIL/log.sh im_daemon_life_cycle mysqld2: waiting to start...
---exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 55 started im_daemon_life_cycle
-
---exec $UTIL/log.sh im_daemon_life_cycle mysqld2: started.
-
-# 2. Restart IM-main;
-
---exec $UTIL/log.sh im_daemon_life_cycle Killing IM-main...
---exec $UTIL/kill_n_check.sh $IM_PATH_PID restarted 55 im_daemon_life_cycle
-
---exec $UTIL/log.sh im_daemon_life_cycle Waiting for IM-main to start accepting connections...
---exec $UTIL/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 55 im_daemon_life_cycle
-
-# 3. Issue some statement -- connection should be re-established.
-
---exec $UTIL/log.sh im_daemon_life_cycle Checking that IM-main processing commands...
-
---replace_column 2 STATE 3 VERSION_NUMBER 4 VERSION
-SHOW INSTANCE STATUS mysqld1;
-
-# 4. Stop mysqld2, because it will not be stopped by IM, as it is nonguarded.
-# So, if it we do not stop it, it will be stopped by mysql-test-run.pl with
-# warning.
-
---exec $UTIL/log.sh im_daemon_life_cycle mysqld2: stopping...
-STOP INSTANCE mysqld2;
-
---exec $UTIL/log.sh im_daemon_life_cycle mysqld2: waiting to stop...
---exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 55 stopped im_daemon_life_cycle
---exec $UTIL/log.sh im_daemon_life_cycle mysqld2: stopped.
-
-###########################################################################
-
---exec $UTIL/log.sh im_daemon_life_cycle BUG12751: done.
diff -Nrup a/mysql-test/suite/im/t/im_instance_conf-im.opt b/mysql-test/suite/im/t/im_instance_conf-im.opt
--- a/mysql-test/suite/im/t/im_instance_conf-im.opt	2007-08-29 18:34:27 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1 +0,0 @@
---monitoring-interval=1
diff -Nrup a/mysql-test/suite/im/t/im_instance_conf.imtest b/mysql-test/suite/im/t/im_instance_conf.imtest
--- a/mysql-test/suite/im/t/im_instance_conf.imtest	2007-08-29 21:02:31 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,244 +0,0 @@
-###########################################################################
-#
-# This test suite checks the following statements:
-#   - CREATE INSTANCE <instance_name> [option1[=option1_value], ...];
-#   - DROP INSTANCE <instance_name>;
-#
-# For CREATE INSTANCE we check that:
-#   - CREATE INSTANCE succeeds for non-existing instance;
-#   - CREATE INSTANCE fails for existing instance;
-#   - CREATE INSTANCE can get additional options with and w/o values;
-#   - CREATE INSTANCE parses options and handles grammar errors correctly.
-#     Check that strings with spaces are handled correctly, unknown (for
-#     mysqld) options should also be handled;
-#   - CREATE INSTANCE updates both config file and internal configuration cache;
-#   - CREATE INSTANCE allows to create instances only with properly formed
-#     names (mysqld*);
-#
-# For DROP INSTANCE we check that:
-#   - DROP INSTANCE succeeds for existing instance;
-#   - DROP INSTANCE fails for non-existing instance;
-#   - DROP INSTANCE fails for active instance.
-#   - DROP INSTANCE updates both config file and internal configuration cache;
-#
-# NOTE: each CREATE INSTANCE statement must specify socket-file-name, otherwise
-# this results of the test can be affected by another running test suite.
-#
-###########################################################################
-
---source suite/im/t/im_check_env.inc
-
-###########################################################################
-#
-# Check starting conditions.
-#
-###########################################################################
-
-# Check that the configuration file contains only instances that we expect.
-
---echo --------------------------------------------------------------------
---exec grep '^server_id[^a-zA-Z0-9_\-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
-###########################################################################
-#
-# CREATE INSTANCE tests.
-#
-###########################################################################
-
-# Check that CREATE INSTANCE succeeds for non-existing instance and also check
-# that both config file and internal configuration cache have been updated.
-
-CREATE INSTANCE mysqld3
-  server_id = 3,
-  socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
-
-SHOW INSTANCES;
- 
---echo --------------------------------------------------------------------
---exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
-# Check that CREATE INSTANCE fails for existing instance. Let's all three
-# existing instances (running one, stopped one and just created one). Just in
-# case...
-
---error 3012 # ER_CREATE_EXISTING_INSTANCE
-CREATE INSTANCE mysqld1;
-
---error 3012 # ER_CREATE_EXISTING_INSTANCE
-CREATE INSTANCE mysqld2;
-
---error 3012 # ER_CREATE_EXISTING_INSTANCE
-CREATE INSTANCE mysqld3;
-
-# Check that CREATE INSTANCE can get additional options with and w/o values.
-# Ensure that config file is updated properly.
-
-#   - without values;
-
---echo --------------------------------------------------------------------
---exec grep "^nonguarded\$" $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
-CREATE INSTANCE mysqld4
-  nonguarded,
-  server_id = 4,
-  socket = "$MYSQL_TMP_DIR/mysqld_4.sock";
-
-SHOW INSTANCES;
-
---echo --------------------------------------------------------------------
---exec grep "^nonguarded\$" $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
-#   - with value;
-
---echo --------------------------------------------------------------------
---exec grep '^test-A[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-B[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-CREATE INSTANCE mysqld5
-  test-A = 000,
-  test-B = test,
-  server_id = 5,
-  socket = "$MYSQL_TMP_DIR/mysqld_5.sock";
-
-SHOW INSTANCES;
-
---echo --------------------------------------------------------------------
---exec grep '^test-A[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-B[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
-# Check that CREATE INSTANCE parses options and handles grammar errors
-# correctly. Check that strings with spaces are handled correctly,
-# unknown (for mysqld) options should also be handled.
-
-#   - check handling of extra spaces;
-
---echo --------------------------------------------------------------------
---exec grep '^test-C1[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-C2[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-CREATE INSTANCE mysqld6
-  test-C1  =  10  ,
-  test-C2  =  02  ,
-  server_id = 6,
-  socket = "$MYSQL_TMP_DIR/mysqld_6.sock";
-
-SHOW INSTANCES;
-
---echo --------------------------------------------------------------------
---exec grep '^test-C1[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-C2[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
-#   - check handling of grammar error;
-
---echo --------------------------------------------------------------------
---exec grep '^test-D[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-E[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
---error ER_SYNTAX_ERROR
-CREATE INSTANCE mysqld7  test-D  =  test-D-value  ;
-SHOW INSTANCES;
-
---error ER_SYNTAX_ERROR
-CREATE INSTANCE mysqld8  test-E  0  ;
-SHOW INSTANCES;
-
---error ER_SYNTAX_ERROR
-CREATE INSTANCE mysqld8  test-F  =  ;
-SHOW INSTANCES;
-
---echo --------------------------------------------------------------------
---exec grep '^test-D[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-E[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-#   - check parsing of string option values
-
---echo --------------------------------------------------------------------
---exec grep '^test-1[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-2[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-3[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-4[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-5[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-6[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-7[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-CREATE INSTANCE mysqld9
-  test-1=" hello world ",
-  test-2='  ',
-  server_id = 9,
-  socket = "$MYSQL_TMP_DIR/mysqld_9.sock";
-SHOW INSTANCES;
-
-CREATE INSTANCE mysqld10
-  test-3='\b\babc\sdef',
-  server_id = 10,
-  socket = "$MYSQL_TMP_DIR/mysqld_10.sock";
-# test-3='abc def'
-SHOW INSTANCES;
-
-CREATE INSTANCE mysqld11
-  test-4='abc\tdef',
-  test-5='abc\ndef',
-  server_id = 11,
-  socket = "$MYSQL_TMP_DIR/mysqld_11.sock";
-SHOW INSTANCES;
-
-CREATE INSTANCE mysqld12
-  test-6="abc\rdef",
-  test-7="abc\\def",
-  server_id = 12,
-  socket = "$MYSQL_TMP_DIR/mysqld_12.sock";
-# test-6=abc
-SHOW INSTANCES;
-
---error ER_SYNTAX_ERROR
-CREATE INSTANCE mysqld13 test-bad=' \ ';
-SHOW INSTANCES;
-
---echo --------------------------------------------------------------------
---exec grep '^test-1[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-2[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-3[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-4[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-5[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-6[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-7[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-bad' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-
-# Check that CREATE INSTANCE allows to create instances only with properly
-# formed names (mysqld*).
-
---error 3014 # ER_MALFORMED_INSTANCE_NAME
-CREATE INSTANCE qqq1;
-
diff -Nrup a/mysql-test/suite/im/t/im_life_cycle-im.opt b/mysql-test/suite/im/t/im_life_cycle-im.opt
--- a/mysql-test/suite/im/t/im_life_cycle-im.opt	2007-08-29 18:34:27 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1 +0,0 @@
---monitoring-interval=1
diff -Nrup a/mysql-test/suite/im/t/im_life_cycle.imtest b/mysql-test/suite/im/t/im_life_cycle.imtest
--- a/mysql-test/suite/im/t/im_life_cycle.imtest	2007-08-29 21:02:31 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,205 +0,0 @@
-let $UTIL=$MYSQL_TEST_DIR/suite/im/t;
-
-###########################################################################
-#
-# This file contains test for (1.1) test suite.
-#
-# Consult WL#2789 for more information.
-#
-###########################################################################
-
---source suite/im/t/im_check_env.inc
-
-###########################################################################
-#
-# 1.1.2. Check 'START INSTANCE' command:
-#  - start the second instance;
-#  - check that it is reported as online;
-#  - execute some SQL-statement on mysqld2 to ensure that it is really up and
-#    running;
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.2.
---echo --------------------------------------------------------------------
-
-START INSTANCE mysqld2;
-# FIXME: START INSTANCE should be synchronous.
---exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_life_cycle
-
-# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
-# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
-# its pid file is not enough, because it is unknown when IM detects that
-# mysqld has started.
-# SHOW INSTANCES;
-
---connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD2_PORT,$IM_MYSQLD2_SOCK)
---connection mysql_con
-
---replace_result $IM_MYSQLD2_PORT IM_MYSQLD2_PORT
-SHOW VARIABLES LIKE 'port';
-
---connection default
---disconnect mysql_con
-
-###########################################################################
-#
-# 1.1.3. Check 'STOP INSTANCE' command:
-#  - stop the second instance;
-#  - check that it is reported as offline;
-#  - TODO: try to execute some SQL-statement to ensure that it is really down;
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.3.
---echo --------------------------------------------------------------------
-
-STOP INSTANCE mysqld2;
-# FIXME: STOP INSTANCE should be synchronous.
---exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped im_life_cycle
-
-# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
-# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
-# its pid file is not enough, because it is unknown when IM detects that
-# mysqld has started.
-# SHOW INSTANCES;
-
-###########################################################################
-#
-# 1.1.4. Check that Instance Manager reports correct errors for 'START
-# INSTANCE' command:
-#   - if the client tries to start unregistered instance;
-#   - if the client tries to start already started instance;
-#   - if the client submits invalid arguments;
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.4.
---echo --------------------------------------------------------------------
-
---error 3000 # ER_BAD_INSTANCE_NAME
-START INSTANCE mysqld3;
-
---error 3002 # ER_INSTANCE_ALREADY_STARTED
-START INSTANCE mysqld1;
-
-###########################################################################
-#
-# 1.1.5. Check that Instance Manager reports correct errors for
-#        'STOP INSTANCE' command:
-#   - if the client tries to start unregistered instance;
-#   - if the client tries to start already stopped instance;
-#   - if the client submits invalid arguments;
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.5.
---echo --------------------------------------------------------------------
-
---error 3000 # ER_BAD_INSTANCE_NAME
-STOP INSTANCE mysqld3;
-
-# TODO: IM should be fixed.
-# BUG#12673: Instance Manager allows to stop the instance many times
-# --error 3002 # ER_INSTANCE_ALREADY_STARTED
-# STOP INSTANCE mysqld2;
-
-###########################################################################
-#
-# 1.1.6. Check that Instance Manager is able to restart guarded instances.
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.6.
---echo --------------------------------------------------------------------
-
---exec $UTIL/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted 30 im_life_cycle
-
-# Give some time to IM to detect that mysqld was restarted. It should be
-# longer than monitoring interval.
-
---sleep 3
-
-SHOW INSTANCES;
-
-###########################################################################
-#
-# 1.1.7. Check that Instance Manager does not restart non-guarded instance.
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.7.
---echo --------------------------------------------------------------------
-
-START INSTANCE mysqld2;
-# FIXME: START INSTANCE should be synchronous.
---exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_life_cycle
-
-# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
-# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
-# its pid file is not enough, because it is unknown when IM detects that
-# mysqld has started.
-# SHOW INSTANCES;
-
---exec $UTIL/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed 10 im_life_cycle
-
-# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
-# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
-# its pid file is not enough, because it is unknown when IM detects that
-# mysqld has started.
-# SHOW INSTANCES;
-
-###########################################################################
-#
-# 1.1.8. Check that Instance Manager returns an error on
-# incomplete SHOW INSTANCE STATUS command.
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.8.
---echo --------------------------------------------------------------------
-
---error ER_SYNTAX_ERROR
-SHOW INSTANCE STATUS;
-
-#
-# Tests for bug fixes
-#
-
-#
-# Bug #12813    Instance Manager: START/STOP INSTANCE commands accept
-#                                 a list as argument.
-#
-
---echo
---echo --------------------------------------------------------------------
---echo -- BUG#12813
---echo --------------------------------------------------------------------
-
---error ER_SYNTAX_ERROR
-START INSTANCE mysqld1,mysqld2,mysqld3;
-
---error ER_SYNTAX_ERROR
-STOP INSTANCE mysqld1,mysqld2,mysqld3;
-
-#
-# Bug #12673: Instance Manager: allows to stop the instance many times
-#
---error 3001
-STOP INSTANCE mysqld2;
-
---echo End of 5.0 tests
diff -Nrup a/mysql-test/suite/im/t/im_options-im.opt b/mysql-test/suite/im/t/im_options-im.opt
--- a/mysql-test/suite/im/t/im_options-im.opt	2007-08-29 18:34:27 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1 +0,0 @@
---monitoring-interval=1
diff -Nrup a/mysql-test/suite/im/t/im_options.imtest b/mysql-test/suite/im/t/im_options.imtest
--- a/mysql-test/suite/im/t/im_options.imtest	2007-08-29 21:02:31 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,248 +0,0 @@
-###########################################################################
-#
-# This test suite checks the following statements:
-#   - SET <instance id>.<option name> = <option value>;
-#   - UNSET <instance id>.<option name> = <option value>;
-#   - FLUSH INSTANCES;
-#
-# For SET/UNSET we check that:
-#   - SET ignores spaces correctly;
-#   - UNSET does not allow option-value part (= <option value>);
-#   - SET/UNSET can be applied several times w/o error;
-#   - SET/UNSET is allowed only for stopped instances;
-#   - SET/UNSET updates both the configuration cache in IM and
-#     the configuration file;
-#
-# For FLUSH INSTANCES we check that:
-#   - FLUSH INSTANCES is allowed only when all instances are stopped;
-#
-# According to the IM implementation details, we should play at least with the
-# following options:
-#   - server_id
-#   - port
-#   - nonguarded
-#
-# Let's test SET statement on the option 'server_id'. It's expected that
-# originally the instances have the following server ids and states:
-#  - mysqld1: server_id: 1; running (online)
-#  - mysqld2: server_id: 2; stopped (offline)
-#
-# NOTE: each CREATE INSTANCE statement must specify socket-file-name, otherwise
-# this results of the test can be affected by another running test suite.
-#
-###########################################################################
-
---source suite/im/t/im_check_env.inc
-
-###########################################################################
-#
-# Check that SET/UNSET is allowed only for stopped instances.
-#
-###########################################################################
-
-# - check that SET/UNSET is denied for running instances;
-
---error 3015 # ER_INSTANCE_IS_ACTIVE
-UNSET mysqld1.server_id;
-
---error 3015 # ER_INSTANCE_IS_ACTIVE
-SET mysqld1.server_id = 11;
-
-# - check that SET/UNSET is denied for active instances:
-#   - create dummy misconfigured instance;
-#   - start it;
-#   - try to set/unset options;
-
-CREATE INSTANCE mysqld3
-  datadir = '/',
-  server_id = 3,
-  socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
-START INSTANCE mysqld3;
-
-# FIXME: START INSTANCE should be synchronous.
---sleep 3
-# should be longer than monitoring interval and enough to start instance.
-
-# NOTE: We can not analyze state of the instance here -- it can be Failed or
-# Starting because Instance Manager is trying to start the misconfigured
-# instance several times.
-
---error 3015 # ER_INSTANCE_IS_ACTIVE
-UNSET mysqld3.server_id;
-
---error 3015 # ER_INSTANCE_IS_ACTIVE
-SET mysqld3.server_id = 11;
-
-STOP INSTANCE mysqld3;
-
-# FIXME: STOP INSTANCE should be synchronous.
---sleep 3
-# should be longer than monitoring interval and enough to stop instance.
-
---replace_column 3 VERSION_NUMBER 4 VERSION
-SHOW INSTANCE STATUS mysqld3;
-
-# - check that SET/UNSET succeed for stopped instances;
-# - check that SET/UNSET can be applied multiple times;
-
-UNSET mysqld2.server_id;
-UNSET mysqld2.server_id;
-
---replace_column 2 option_value
-SHOW INSTANCE OPTIONS mysqld2;
-
-SET mysqld2.server_id = 2;
-SET mysqld2.server_id = 2;
-
---replace_column 2 option_value
-SHOW INSTANCE OPTIONS mysqld2;
-
-# - check that UNSET does not allow option-value part (= <option value>);
-
---error ER_SYNTAX_ERROR
-UNSET mysqld2.server_id = 11;
-
-# - check that SET/UNSET working properly with multiple options;
-
-SET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc = 0010, mysqld3.ddd = 0020;
-
---echo --------------------------------------------------------------------
---exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
---exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
---exec grep '^ccc[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
---exec grep '^ddd[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
-
-UNSET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc, mysqld3.ddd;
-
---echo --------------------------------------------------------------------
---exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^ccc[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^ddd[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-# - check that if some instance name is invalid or the active is active,
-#   whole SET-statement will not be executed;
-
---error 3000 # ER_BAD_INSTANCE_NAME
-SET mysqld2.aaa, mysqld3.bbb, mysqld.ccc = 0010;
-
---echo --------------------------------------------------------------------
---exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^ccc[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
---error 3015 # ER_INSTANCE_IS_ACTIVE
-SET mysqld2.aaa, mysqld3.bbb, mysqld1.ccc = 0010;
-
---echo --------------------------------------------------------------------
---exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^ccc[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-# - check that if some instance name is invalid or the active is active,
-#   whole UNSET-statement will not be executed;
-
---error 3000 # ER_BAD_INSTANCE_NAME
-UNSET mysqld2.server_id, mysqld3.server_id, mysqld.ccc;
-
---echo --------------------------------------------------------------------
---exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
---error 3015 # ER_INSTANCE_IS_ACTIVE
-UNSET mysqld2.server_id, mysqld3.server_id, mysqld1.ccc;
-
---echo --------------------------------------------------------------------
---exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
-DROP INSTANCE mysqld3;
-
-# - check that spaces are handled correctly;
-
-SET mysqld2.server_id=222;
-SET mysqld2.server_id = 222;
-SET   mysqld2.server_id   =  222  ;
-SET   mysqld2  .  server_id  =  222  ;
-SET   mysqld2  .  server_id  =  222  , mysqld2  .  aaa  , mysqld2  .  bbb  ;
-
---echo --------------------------------------------------------------------
---exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
---exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
---exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
-
-UNSET mysqld2  . aaa  ,  mysqld2  .  bbb ;
-
---echo --------------------------------------------------------------------
---exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
---exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-###########################################################################
-#
-# Check that SET/UNSET updates both the configuration cache in IM and
-# the configuration file.
-#
-###########################################################################
-
-#   - check that the configuration file has been updated (i.e. contains
-#     server_id=SERVER_ID for mysqld2);
-
---echo --------------------------------------------------------------------
---exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
-
-#   - (for mysqld1) check that the running instance has not been affected:
-#     connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
-#     returns zero;
-
---connection mysql1_con
-
-SHOW VARIABLES LIKE 'server_id';
-
---connection default
-
-#   - check that internal cache of Instance Manager has been affected;
-#     TODO: we should check only server_id option here.
-
-# SHOW INSTANCE OPTIONS mysqld2;
-
-###########################################################################
-#
-# Check that FLUSH INSTANCES is allowed only when all instances are stopped.
-#
-###########################################################################
-
-SHOW INSTANCES;
-
---error 3016 # ER_THERE_IS_ACTIVE_INSTACE
-FLUSH INSTANCES;
-
-STOP INSTANCE mysqld1;
-# FIXME: STOP INSTANCE should be synchronous.
---sleep 3
-# should be longer than monitoring interval and enough to stop instance.
-
-SHOW INSTANCES;
-
-FLUSH INSTANCES;
diff -Nrup a/mysql-test/suite/im/t/im_utils-im.opt b/mysql-test/suite/im/t/im_utils-im.opt
--- a/mysql-test/suite/im/t/im_utils-im.opt	2007-08-29 18:34:27 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1 +0,0 @@
---monitoring-interval=1
diff -Nrup a/mysql-test/suite/im/t/im_utils.imtest b/mysql-test/suite/im/t/im_utils.imtest
--- a/mysql-test/suite/im/t/im_utils.imtest	2007-08-29 21:02:31 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,107 +0,0 @@
-###########################################################################
-#
-# This file contains test for (2) test suite.
-#
-# Consult WL#2789 for more information.
-#
-###########################################################################
-
---source suite/im/t/im_check_env.inc
-
-let $UTIL=$MYSQL_TEST_DIR/suite/im/t;
-
-###########################################################################
-
-#
-# Check 'SHOW INSTANCE OPTIONS' command.
-#
-# Since configuration of an mysqld-instance contains directories, we should
-# completely ignore the second column (values) in order to make the test
-# case produce the same results on different installations;
-# TODO: ignore values of only directory-specific options.
-#
-
---replace_column 2 VALUE
-SHOW INSTANCE OPTIONS mysqld1;
-
---replace_column 2 VALUE
-SHOW INSTANCE OPTIONS mysqld2;
-
-#
-# Before checking log files, we should start the second instance (mysqld2) to
-# give it a chance to create log files.
-#
-
-START INSTANCE mysqld2;
---exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_utils
-
-STOP INSTANCE mysqld2;
---exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped im_utils
-
-#
-# Check 'SHOW LOG FILES' command:
-#  - check that log files of both offline and online instances are accessible;
-#  - since placement of the log files is installation-specific, we should
-#    ignore it in comparisson;
-#  - also, we should ignore log file size, since it may depend on the version
-#    being tested;
-#
-
---replace_column 2 PATH 3 FILE_SIZE
-SHOW mysqld1 LOG FILES;
-
---replace_column 2 PATH 3 FILE_SIZE
-SHOW mysqld2 LOG FILES;
-
-#
-# Check 'SHOW LOG' command:
-#  - check that all three kinds of logs are available for both offline and
-#    online instances;
-#  - we should ignore the value, because it is very specific and depends on
-#    many factors; we only check that Instance Manager is able to provide log
-#    files.
-#
-
-# mysqld1 (online) w/o the optional argument.
-
---replace_column 1 LOG_DATA
-SHOW mysqld1 LOG ERROR 10;
-
---replace_column 1 LOG_DATA
-SHOW mysqld1 LOG SLOW 10;
-
---replace_column 1 LOG_DATA
-SHOW mysqld1 LOG GENERAL 10;
-
-# mysqld1 (online) with the optional argument.
-
---replace_column 1 LOG_DATA
-SHOW mysqld1 LOG ERROR 10, 2;
-
---replace_column 1 LOG_DATA
-SHOW mysqld1 LOG SLOW 10, 2;
-
---replace_column 1 LOG_DATA
-SHOW mysqld1 LOG GENERAL 10, 2;
-
-# mysqld2 (offline) w/o the optional argument.
-
---replace_column 1 LOG_DATA
-SHOW mysqld2 LOG ERROR 10;
-
---replace_column 1 LOG_DATA
-SHOW mysqld2 LOG SLOW 10;
-
---replace_column 1 LOG_DATA
-SHOW mysqld2 LOG GENERAL 10;
-
-# mysqld2 (offline) with the optional argument.
-
---replace_column 1 LOG_DATA
-SHOW mysqld2 LOG ERROR 10, 2;
-
---replace_column 1 LOG_DATA
-SHOW mysqld2 LOG SLOW 10, 2;
-
---replace_column 1 LOG_DATA
-SHOW mysqld2 LOG GENERAL 10, 2;
diff -Nrup a/mysql-test/suite/im/t/kill_n_check.sh b/mysql-test/suite/im/t/kill_n_check.sh
--- a/mysql-test/suite/im/t/kill_n_check.sh	2007-08-29 18:43:08 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,147 +0,0 @@
-#!/bin/sh
-
-###########################################################################
-
-# NOTE: this script returns 0 (success) even in case of failure (except for
-# usage-error). This is because this script is executed under
-# mysql-test-run[.pl] and it's better to examine particular problem in log
-# file, than just having said that the test case has failed.
-
-###########################################################################
-
-basename=`basename "$0"`
-dirname=`dirname "$0"`
-
-###########################################################################
-
-. "$dirname/utils.sh"
-
-###########################################################################
-
-check_restart()
-{
-  if [ ! -r "$pid_path" ]; then
-    log_debug "No '$pid_path' found."
-    user_msg='the process was killed'
-    return 1
-  fi
-
-  new_pid=`cat "$pid_path" 2>/dev/null`
-  err_code=$?
-
-  log_debug "err_code: $err_code; original_pid: $original_pid; new_pid: $new_pid."
-
-  if [ $err_code -eq 0 -a "$original_pid" = "$new_pid" ]; then
-    log_debug "The process was not restarted."
-    user_msg='the process was not restarted'
-    return 1
-  fi
-
-  log_debug "The process was restarted."
-  user_msg='the process was restarted'
-  return 0
-}
-
-###########################################################################
-
-if [ $# -ne 4 ]; then
-  echo "Usage: $basename <pid file path> killed|restarted <timeout> <test id>"
-  exit 1
-fi
-
-pid_path="$1"
-expected_result="$2"
-total_timeout="$3"
-test_id="$4"
-log_file="$MYSQLTEST_VARDIR/log/$test_id.script.log"
-
-log_debug "-- $basename: starting --"
-log_debug "pid_path: '$pid_path'"
-log_debug "expected_result: '$expected_result'"
-log_debug "total_timeout: '$total_timeout'"
-log_debug "test_id: '$test_id'"
-log_debug "log_file: '$log_file'"
-
-###########################################################################
-
-if [ "$expected_result" != 'killed' -a \
-     "$expected_result" != 'restarted' ]; then
-  log_error "Invalid second argument ($expected_result): 'killed' or 'restarted' expected."
-  quit 0
-fi
-
-if [ -z "$pid_path" ]; then
-  log_error "Invalid PID path ($pid_path)."
-  quit 0
-fi
-
-if [ ! -r "$pid_path" ]; then
-  log_error "PID file ($pid_path) does not exist."
-  quit 0
-fi
-
-if [ -z "$total_timeout" ]; then
-  log_error "Timeout is not specified."
-  quit 0
-fi
-
-###########################################################################
-
-original_pid=`cat "$pid_path"`
-log_debug "original_pid: $original_pid."
-
-log_info "Killing the process..."
-
-kill -9 $original_pid
-
-###########################################################################
-
-log_info "Waiting..."
-
-if [ "$expected_result" = "restarted" ]; then
-
-  # Wait for the process to restart.
-
-  cur_attempt=1
-
-  while true; do
-
-    log_debug "cur_attempt: $cur_attempt."
-
-    if check_restart; then
-      log_info "Success: $user_msg."
-      quit 0
-    fi
-
-    [ $cur_attempt -ge $total_timeout ] && break
-
-    log_debug "Sleeping for 1 second..."
-    sleep 1
-
-    cur_attempt=`expr $cur_attempt + 1`
-
-  done
-
-  log_error "$user_msg."
-  quit 0
-
-else # $expected_result == killed
-
-  # Here we have to sleep for some long time to ensure that the process will
-  # not be restarted.
-
-  log_debug "Sleeping for $total_timeout seconds..."
-  sleep $total_timeout
-
-  new_pid=`cat "$pid_path" 2>/dev/null`
-  log_debug "new_pid: $new_pid."
-
-  if [ "$new_pid" -a "$new_pid" -ne "$original_pid" ]; then
-    log_error "The process was restarted."
-  else
-    log_info "Success: the process was killed."
-  fi
-
-  quit 0
-
-fi
diff -Nrup a/mysql-test/suite/im/t/log.sh b/mysql-test/suite/im/t/log.sh
--- a/mysql-test/suite/im/t/log.sh	2007-08-29 18:42:41 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-###########################################################################
-
-basename=`basename "$0"`
-dirname=`dirname "$0"`
-
-###########################################################################
-
-. "$dirname/utils.sh"
-
-###########################################################################
-
-if [ $# -lt 2 ]; then
-  echo "Usage: $basename <test id> log message ..."
-  exit 1
-fi
-
-test_id="$1"
-log_file="$MYSQLTEST_VARDIR/log/$test_id.script.log"
-
-shift
-
-log_debug "$*"
diff -Nrup a/mysql-test/suite/im/t/utils.sh b/mysql-test/suite/im/t/utils.sh
--- a/mysql-test/suite/im/t/utils.sh	2007-08-29 18:42:16 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,55 +0,0 @@
-###########################################################################
-#
-# This file provides utility functions and is included by other scripts.
-#
-# The following global variables must be set before calling functions from this
-# file:
-#   - basename -- base name of the calling script (main application);
-#   - log_file -- where to store log records;
-#
-###########################################################################
-
-log()
-{
-  [ -z "$log_file" ] && return;
-
-  log_level="$1"
-  log_msg="$2"
-  ts=`date`
-
-  echo "[$ts] [$basename] [$log_level] $log_msg" >> "$log_file";
-}
-
-###########################################################################
-
-log_debug()
-{
-  log 'DEBUG' "$1"
-}
-
-###########################################################################
-
-log_info()
-{
-  log 'INFO' "$1"
-  echo "$1"
-}
-
-###########################################################################
-
-log_error()
-{
-  log 'ERROR' "$1"
-  echo "Error: $1"
-}
-
-###########################################################################
-
-quit()
-{
-  exit_status="$1"
-
-  log_debug "-- $basename: finished (exit_status: $exit_status) --"
-
-  exit $exit_status
-}
diff -Nrup a/mysql-test/suite/im/t/wait_for_process.sh b/mysql-test/suite/im/t/wait_for_process.sh
--- a/mysql-test/suite/im/t/wait_for_process.sh	2007-08-29 18:42:26 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,114 +0,0 @@
-#!/bin/sh
-
-###########################################################################
-
-# NOTE: this script returns 0 (success) even in case of failure (except for
-# usage-error). This is because this script is executed under
-# mysql-test-run[.pl] and it's better to examine particular problem in log
-# file, than just having said that the test case has failed.
-
-###########################################################################
-
-basename=`basename "$0"`
-dirname=`dirname "$0"`
-
-###########################################################################
-
-. "$dirname/utils.sh"
-
-###########################################################################
-
-check_started()
-{
-  if [ ! -r "$pid_path" ]; then
-    log_debug "No PID-file ($pid_path) found -- not started."
-    return 1
-  fi
-
-  new_pid=`cat "$pid_path" 2>/dev/null`
-  err_code=$?
-
-  log_debug "err_code: $err_code; new_pid: $new_pid."
-
-  if [ $? -ne 0 -o -z "$new_pid" ]; then
-    log_debug "The process was not started."
-    return 1
-  fi
-
-  log_debug "The process was started."
-  return 0
-}
-
-###########################################################################
-
-check_stopped()
-{
-  if [ -r "$pid_path" ]; then
-    log_debug "PID-file '$pid_path' exists -- not stopped."
-    return 1
-  fi
-
-  log_debug "No PID-file ($pid_path) found -- stopped."
-  return 0
-}
-
-###########################################################################
-
-if [ $# -ne 4 ]; then
-  echo "Usage: $basename <pid file path> <total attempts> started|stopped <test id>"
-  exit 1
-fi
-
-pid_path="$1"
-total_attempts="$2"
-event="$3"
-test_id="$4"
-log_file="$MYSQLTEST_VARDIR/log/$test_id.script.log"
-
-log_debug "-- $basename: starting --"
-log_debug "pid_path: '$pid_path'"
-log_debug "total_attempts: '$total_attempts'"
-log_debug "event: '$event'"
-log_debug "test_id: '$test_id'"
-log_debug "log_file: '$log_file'"
-
-###########################################################################
-
-case "$event" in
-  started)
-    check_fn='check_started';
-    ;;
-
-  stopped)
-    check_fn='check_stopped';
-    ;;
-
-  *)
-    log_error "Invalid third argument ('started' or 'stopped' expected)."
-    quit 0
-esac
-
-###########################################################################
-
-cur_attempt=1
-
-while true; do
-
-  log_debug "cur_attempt: $cur_attempt."
-
-  if ( eval $check_fn ); then
-    log_info "Success: the process has been $event."
-    quit 0
-  fi
-
-  [ $cur_attempt -ge $total_attempts ] && break
-
-  log_debug "Sleeping for 1 second..."
-  sleep 1
-
-  cur_attempt=`expr $cur_attempt + 1`
-
-done
-
-log_error "The process has not been $event in $total_attempts secs."
-quit 0
diff -Nrup a/mysql-test/suite/im/t/wait_for_socket.sh b/mysql-test/suite/im/t/wait_for_socket.sh
--- a/mysql-test/suite/im/t/wait_for_socket.sh	2007-08-29 18:42:32 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,94 +0,0 @@
-#!/bin/sh
-
-###########################################################################
-
-# NOTE: this script returns 0 (success) even in case of failure (except for
-# usage-error). This is because this script is executed under
-# mysql-test-run[.pl] and it's better to examine particular problem in log
-# file, than just having said that the test case has failed.
-
-###########################################################################
-
-basename=`basename "$0"`
-dirname=`dirname "$0"`
-
-###########################################################################
-
-. "$dirname/utils.sh"
-
-###########################################################################
-
-if [ $# -ne 7 ]; then
-  echo "Usage: wait_for_socket.sh <executable path> <socket path> <username> <password> <db> <timeout> <test id>"
-  exit 1
-fi
-
-client_exe="$1"
-socket_path="$2"
-username="$3"
-password="$4"
-db="$5"
-total_timeout="$6"
-test_id="$7"
-log_file="$MYSQLTEST_VARDIR/log/$test_id.script.log"
-
-log_debug "-- $basename: starting --"
-log_debug "client_exe: '$client_exe'"
-log_debug "socket_path: '$socket_path'"
-log_debug "username: '$username'"
-log_debug "password: '$password'"
-log_debug "db: '$db'"
-log_debug "total_timeout: '$total_timeout'"
-log_debug "test_id: '$test_id'"
-log_debug "log_file: '$log_file'"
-
-###########################################################################
-
-if [ -z "$client_exe" ]; then
-  log_error "Invalid path to client executable ($client_exe)."
-  quit 0;
-fi
-
-if [ ! -x "$client_exe" ]; then
-  log_error "Client by path '$client_exe' is not available."
-  quit 0;
-fi
-
-if [ -z "$socket_path" ]; then
-  log_error "Invalid socket patch ($socket_path)."
-  quit 0
-fi
-
-###########################################################################
-
-client_args="--no-defaults --silent --socket=$socket_path --connect_timeout=1 "
-
-[ -n "$username" ] && client_args="$client_args --user=$username "
-[ -n "$password" ] && client_args="$client_args --password=$password "
-[ -n "$db" ] && client_args="$client_args $db"
-
-log_debug "client_args: '$client_args'"
-
-###########################################################################
-
-cur_attempt=1
-
-while true; do
-
-  log_debug "cur_attempt: $cur_attempt."
-
-  if ( echo 'quit' | "$client_exe" $client_args >/dev/null 2>&1 ); then
-    log_info "Success: server is ready to accept connection on socket."
-    quit 0
-  fi
-
-  [ $cur_attempt -ge $total_timeout ] && break
-
-  sleep 1
-
-  cur_attempt=`expr $cur_attempt + 1`
-
-done
-
-log_error "Server does not accept connections after $total_timeout seconds."
-quit 0
diff -Nrup a/server-tools/CMakeLists.txt b/server-tools/CMakeLists.txt
--- a/server-tools/CMakeLists.txt	2007-02-14 12:55:37 +03:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,33 +0,0 @@
-# Copyright (C) 2006 MySQL AB
-# 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
-
-ADD_DEFINITIONS(-DMYSQL_SERVER -DMYSQL_INSTANCE_MANAGER)
-INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/sql
-                    ${PROJECT_SOURCE_DIR}/extra/yassl/include)
- 
-ADD_EXECUTABLE(mysqlmanager buffer.cc command.cc commands.cc guardian.cc instance.cc instance_map.cc
-                            instance_options.cc listener.cc log.cc manager.cc messages.cc mysql_connection.cc
-                            mysqlmanager.cc options.cc parse.cc parse_output.cc priv.cc protocol.cc
-                            thread_registry.cc user_map.cc imservice.cpp windowsservice.cpp
-                            user_management_commands.cc
-                            ../../sql/net_serv.cc ../../sql-common/pack.c ../../sql/password.c
-                            ../../sql/sql_state.c ../../sql-common/client.c ../../libmysql/get_password.c
-                            ../../libmysql/errmsg.c)
-
-ADD_DEPENDENCIES(mysqlmanager GenError)
-TARGET_LINK_LIBRARIES(mysqlmanager dbug mysys strings taocrypt vio yassl zlib wsock32)
diff -Nrup a/server-tools/Makefile.am b/server-tools/Makefile.am
--- a/server-tools/Makefile.am	2006-12-31 03:16:32 +03:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,20 +0,0 @@
-# Copyright (C) 2003, 2006 MySQL AB
-# 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-SUBDIRS = . instance-manager
-DIST_SUBDIRS = . instance-manager
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%
diff -Nrup a/server-tools/instance-manager/CMakeLists.txt b/server-tools/instance-manager/CMakeLists.txt
--- a/server-tools/instance-manager/CMakeLists.txt	2007-08-07 01:14:47 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,38 +0,0 @@
-# Copyright (C) 2006 MySQL AB
-# 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake")
-
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
-
-ADD_DEFINITIONS(-DMYSQL_SERVER -DMYSQL_INSTANCE_MANAGER)
-INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/sql
-                    ${PROJECT_SOURCE_DIR}/extra/yassl/include)
- 
-ADD_EXECUTABLE(mysqlmanager buffer.cc command.cc commands.cc guardian.cc instance.cc instance_map.cc
-                            instance_options.cc listener.cc log.cc manager.cc messages.cc mysql_connection.cc
-                            mysqlmanager.cc options.cc parse.cc parse_output.cc priv.cc protocol.cc
-                            thread_registry.cc user_map.cc IMService.cpp WindowsService.cpp
-                            user_management_commands.cc
-                            ../../sql/net_serv.cc ../../sql-common/pack.c ../../sql/password.c
-                            ../../sql/sql_state.c ../../sql-common/client.c ../../libmysql/get_password.c
-                            ../../libmysql/errmsg.c)
-
-ADD_DEPENDENCIES(mysqlmanager GenError)
-TARGET_LINK_LIBRARIES(mysqlmanager debug dbug mysys strings taocrypt vio yassl zlib wsock32)
-
-IF(EMBED_MANIFESTS)
-  MYSQL_EMBED_MANIFEST("mysqlmanager" "asInvoker")
-ENDIF(EMBED_MANIFESTS)
diff -Nrup a/server-tools/instance-manager/IMService.cpp b/server-tools/instance-manager/IMService.cpp
--- a/server-tools/instance-manager/IMService.cpp	2007-03-01 03:58:07 +03:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,124 +0,0 @@
-/* Copyright (C) 2005 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
-
-#include <winsock2.h>
-#include <signal.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")
-{
-}
-
-IMService::~IMService(void)
-{
-}
-
-void IMService::Stop()
-{
-  ReportStatus(SERVICE_STOP_PENDING);
-
-  /* stop the IM work */
-  raise(SIGTERM);
-}
-
-void IMService::Run(DWORD argc, LPTSTR *argv)
-{
-  /* report to the SCM that we're about to start */
-  ReportStatus((DWORD)SERVICE_START_PENDING);
-
-  Options::load(argc, argv);
-
-  /* init goes here */
-  ReportStatus((DWORD)SERVICE_RUNNING);
-
-  /* wait for main loop to terminate */
-  (void) Manager::main();
-  Options::cleanup();
-}
-
-void IMService::Log(const char *msg)
-{
-  log_info(msg);
-}
-
-int IMService::main()
-{
-  IMService winService;
-
-  if (Options::Service::install_as_service)
-  {
-    if (winService.IsInstalled())
-    {
-      log_info("Service is already installed.");
-      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.");
-      return 1;
-    }
-  }
-
-  if (Options::Service::remove_service)
-  {
-    if (!winService.IsInstalled())
-    {
-      log_info("Service is not installed.");
-      return 1;
-    }
-
-    if (winService.Remove())
-    {
-      log_info("Service removed successfully.");
-      return 0;
-    }
-    else
-    {
-      log_error("Service failed to remove.");
-      return 1;
-    }
-  }
-
-  log_info("Initializing Instance Manager service...");
-
-  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.");
-
-    return 1;
-  }
-
-  return 0;
-}
diff -Nrup a/server-tools/instance-manager/IMService.h b/server-tools/instance-manager/IMService.h
--- a/server-tools/instance-manager/IMService.h	2007-02-18 15:45:23 +03:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,32 +0,0 @@
-/* Copyright (C) 2005 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
-
-#pragma once
-#include "WindowsService.h"
-
-class IMService: public WindowsService
-{
-public:
-  static int main();
-
-private:
-  IMService(void);
-  ~IMService(void);
-
-protected:
-  void Log(const char *msg);
-  void Stop();
-  void Run(DWORD argc, LPTSTR *argv);
-};
diff -Nrup a/server-tools/instance-manager/Makefile.am b/server-tools/instance-manager/Makefile.am
--- a/server-tools/instance-manager/Makefile.am	2007-02-18 15:45:24 +03:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,103 +0,0 @@
-# Copyright (C) 2004 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-INCLUDES= @ZLIB_INCLUDES@ -I$(top_srcdir)/include \
-	@openssl_includes@ -I$(top_builddir)/include
-
-DEFS= -DMYSQL_INSTANCE_MANAGER -DMYSQL_SERVER
-
-# As all autoconf variables depend from ${prefix} and being resolved only when
-# make is run, we can not put these defines to a header file (e.g. to
-# default_options.h, generated from default_options.h.in)
-# See automake/autoconf docs for details
-
-noinst_LTLIBRARIES= liboptions.la
-noinst_LIBRARIES=   libnet.a
-
-liboptions_la_CXXFLAGS= $(CXXFLAGS) \
-	-DDEFAULT_PID_FILE_NAME="$(localstatedir)/mysqlmanager.pid" \
-	-DDEFAULT_LOG_FILE_NAME="$(localstatedir)/mysqlmanager.log" \
-	-DDEFAULT_SOCKET_FILE_NAME="/tmp/mysqlmanager.sock" \
-	-DDEFAULT_PASSWORD_FILE_NAME="/etc/mysqlmanager.passwd" \
-	-DDEFAULT_MYSQLD_PATH="$(libexecdir)/mysqld$(EXEEXT)" \
-	-DDEFAULT_CONFIG_FILE="my.cnf" \
-	-DPROTOCOL_VERSION=@PROTOCOL_VERSION@
-
-liboptions_la_SOURCES= options.h options.cc priv.h priv.cc
-liboptions_la_LIBADD= $(top_builddir)/libmysql/get_password.lo
-
-# MySQL sometimes uses symlinks to reuse code 
-# All symlinked files are grouped in libnet.a
-
-nodist_libnet_a_SOURCES= net_serv.cc client_settings.h
-libnet_a_LIBADD= $(top_builddir)/sql/password.$(OBJEXT) \
-	$(top_builddir)/sql/pack.$(OBJEXT) \
-	$(top_builddir)/sql/sql_state.$(OBJEXT) \
-	$(top_builddir)/sql/mini_client_errors.$(OBJEXT)\
-	$(top_builddir)/sql/client.$(OBJEXT)
-
-CLEANFILES= net_serv.cc client_settings.h
-
-net_serv.cc:
-	rm -f net_serv.cc
-	@LN_CP_F@ $(top_srcdir)/sql/net_serv.cc net_serv.cc
-
-client_settings.h:
-	rm -f client_settings.h
-	@LN_CP_F@ $(top_srcdir)/sql/client_settings.h client_settings.h
-
-libexec_PROGRAMS= mysqlmanager
-
-mysqlmanager_CXXFLAGS=  
-
-mysqlmanager_SOURCES=	command.cc command.h mysqlmanager.cc \
-			manager.h manager.cc log.h log.cc \
-			thread_registry.h thread_registry.cc \
-			listener.h listener.cc protocol.h protocol.cc \
-			mysql_connection.h mysql_connection.cc \
-			user_map.h user_map.cc \
-			messages.h messages.cc \
-			commands.h commands.cc \
-			instance.h instance.cc \
-			instance_map.h instance_map.cc\
-			instance_options.h instance_options.cc \
-			buffer.h buffer.cc parse.cc parse.h \
-			guardian.cc guardian.h \
-			parse_output.cc parse_output.h \
-                        mysql_manager_error.h \
-                        portability.h \
-			exit_codes.h \
-			user_management_commands.h \
-			user_management_commands.cc \
-			angel.h \
-			angel.cc
-
-mysqlmanager_LDADD=	@CLIENT_EXTRA_LDFLAGS@ \
-			liboptions.la \
-			libnet.a \
-			$(top_builddir)/vio/libvio.a \
-			$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/strings/libmystrings.a \
-			$(top_builddir)/dbug/libdbug.a \
-			@openssl_libs@ @yassl_libs@ @ZLIB_LIBS@
-
-EXTRA_DIST =		WindowsService.cpp WindowsService.h IMService.cpp \
-			IMService.h CMakeLists.txt
-
-tags:
-	ctags -R *.h *.cc
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%
diff -Nrup a/server-tools/instance-manager/README b/server-tools/instance-manager/README
--- a/server-tools/instance-manager/README	2003-08-16 21:44:00 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,11 +0,0 @@
-Instance Manager - manage MySQL instances locally and remotely.
-
-File description:
- mysqlmanager.cc - entry point to the manager, main, 
- options.{h,cc} - handle startup options
- manager.{h,cc} - manager process
- mysql_connection.{h,cc} - handle one connection with mysql client.
-
-See also instance manager architecture description in mysqlmanager.cc.
-
-
diff -Nrup a/server-tools/instance-manager/WindowsService.cpp b/server-tools/instance-manager/WindowsService.cpp
--- a/server-tools/instance-manager/WindowsService.cpp	2007-03-02 11:04:17 +03:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,231 +0,0 @@
-/* Copyright (C) 2005 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
-
-#include "my_global.h"
-#include <windows.h>
-#include "WindowsService.h"
-
-static WindowsService *gService;
-
-WindowsService::WindowsService(const char *p_serviceName,
-                               const char *p_displayName) :
-  statusCheckpoint(0),
-  serviceName(p_serviceName),
-  displayName(p_displayName),
-  inited(FALSE),
-  dwAcceptedControls(SERVICE_ACCEPT_STOP),
-  debugging(FALSE)
-{
-  DBUG_ASSERT(serviceName != NULL);
-
-  /* TODO: shouldn't we check displayName too (can it really be NULL)? */
-
-  /* WindowsService is assumed to be singleton. Let's assure this. */
-  DBUG_ASSERT(gService == NULL);
-
-  gService= this;
-
-  status.dwServiceType= SERVICE_WIN32_OWN_PROCESS;
-  status.dwServiceSpecificExitCode= 0;
-}
-
-WindowsService::~WindowsService(void)
-{
-}
-
-BOOL WindowsService::Install(const char *username, const char *password)
-{
-  bool ret_val= FALSE;
-  SC_HANDLE newService;
-  SC_HANDLE scm;
-
-  if (IsInstalled())
-    return TRUE;
-
-  // determine the name of the currently executing file
-  char szFilePath[_MAX_PATH];
-  GetModuleFileName(NULL, szFilePath, sizeof(szFilePath));
-
-  // open a connection to the SCM
-  if (!(scm= OpenSCManager(0, 0,SC_MANAGER_CREATE_SERVICE)))
-    return FALSE;
-
-  newService= CreateService(scm, serviceName, displayName,
-                            SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS,
-                            SERVICE_AUTO_START, SERVICE_ERROR_NORMAL,
-                            szFilePath, NULL, NULL, NULL, username,
-                            password);
-
-  if (newService)
-  {
-    CloseServiceHandle(newService);
-    ret_val= TRUE;
-  }
-
-  CloseServiceHandle(scm);
-  return ret_val;
-}
-
-BOOL WindowsService::Init()
-{
-  DBUG_ASSERT(serviceName != NULL);
-
-  if (inited)
-    return TRUE;
-
-  SERVICE_TABLE_ENTRY stb[] =
-  {
-    { (LPSTR)serviceName, (LPSERVICE_MAIN_FUNCTION) ServiceMain},
-    { NULL, NULL }
-  };
-  inited= TRUE;
-  return StartServiceCtrlDispatcher(stb); //register with the Service Manager
-}
-
-BOOL WindowsService::Remove()
-{
-  bool ret_val= FALSE;
-
-  if (!IsInstalled())
-    return TRUE;
-
-  // open a connection to the SCM
-  SC_HANDLE scm= OpenSCManager(0, 0,SC_MANAGER_CREATE_SERVICE);
-  if (!scm)
-    return FALSE;
-
-  SC_HANDLE service= OpenService(scm, serviceName, DELETE);
-  if (service)
-  {
-    if (DeleteService(service))
-      ret_val= TRUE;
-    DWORD dw= ::GetLastError();
-    CloseServiceHandle(service);
-  }
-
-  CloseServiceHandle(scm);
-  return ret_val;
-}
-
-BOOL WindowsService::IsInstalled()
-{
-  BOOL ret_val= FALSE;
-
-  SC_HANDLE scm= ::OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
-  SC_HANDLE serv_handle= ::OpenService(scm, serviceName, SERVICE_QUERY_STATUS);
-
-  ret_val= serv_handle != NULL;
-
-  ::CloseServiceHandle(serv_handle);
-  ::CloseServiceHandle(scm);
-
-  return ret_val;
-}
-
-void WindowsService::SetAcceptedControls(DWORD acceptedControls)
-{
-  dwAcceptedControls= acceptedControls;
-}
-
-
-BOOL WindowsService::ReportStatus(DWORD currentState, DWORD waitHint,
-                                  DWORD dwError)
-{
-  if (debugging)
-    return TRUE;
-
-  if(currentState == SERVICE_START_PENDING)
-    status.dwControlsAccepted= 0;
-  else
-    status.dwControlsAccepted= dwAcceptedControls;
-
-  status.dwCurrentState= currentState;
-  status.dwWin32ExitCode= dwError != 0 ?
-    ERROR_SERVICE_SPECIFIC_ERROR : NO_ERROR;
-  status.dwWaitHint= waitHint;
-  status.dwServiceSpecificExitCode= dwError;
-
-  if(currentState == SERVICE_RUNNING || currentState == SERVICE_STOPPED)
-  {
-    status.dwCheckPoint= 0;
-    statusCheckpoint= 0;
-  }
-  else
-    status.dwCheckPoint= ++statusCheckpoint;
-
-  // Report the status of the service to the service control manager.
-  BOOL result= SetServiceStatus(statusHandle, &status);
-  if (!result)
-    Log("ReportStatus failed");
-
-  return result;
-}
-
-void WindowsService::RegisterAndRun(DWORD argc, LPTSTR *argv)
-{
-  statusHandle= ::RegisterServiceCtrlHandler(serviceName, ControlHandler);
-  if (statusHandle && ReportStatus(SERVICE_START_PENDING))
-    Run(argc, argv);
-  ReportStatus(SERVICE_STOPPED);
-}
-
-void WindowsService::HandleControlCode(DWORD opcode)
-{
-  // Handle the requested control code.
-  switch(opcode) {
-  case SERVICE_CONTROL_STOP:
-    // Stop the service.
-    status.dwCurrentState= SERVICE_STOP_PENDING;
-    Stop();
-    break;
-
-  case SERVICE_CONTROL_PAUSE:
-    status.dwCurrentState= SERVICE_PAUSE_PENDING;
-    Pause();
-    break;
-
-  case SERVICE_CONTROL_CONTINUE:
-    status.dwCurrentState= SERVICE_CONTINUE_PENDING;
-    Continue();
-    break;
-
-  case SERVICE_CONTROL_SHUTDOWN:
-    Shutdown();
-    break;
-
-  case SERVICE_CONTROL_INTERROGATE:
-    ReportStatus(status.dwCurrentState);
-    break;
-
-  default:
-    // invalid control code
-    break;
-  }
-}
-
-void WINAPI WindowsService::ServiceMain(DWORD argc, LPTSTR *argv)
-{
-  DBUG_ASSERT(gService != NULL);
-
-  // register our service control handler:
-  gService->RegisterAndRun(argc, argv);
-}
-
-void WINAPI WindowsService::ControlHandler(DWORD opcode)
-{
-  DBUG_ASSERT(gService != NULL);
-
-  return gService->HandleControlCode(opcode);
-}
diff -Nrup a/server-tools/instance-manager/WindowsService.h b/server-tools/instance-manager/WindowsService.h
--- a/server-tools/instance-manager/WindowsService.h	2007-02-20 20:31:13 +03:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,56 +0,0 @@
-/* Copyright (C) 2005 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
-
-#pragma once
-
-class WindowsService
-{
-protected:
-  bool                  inited;
-  const char            *serviceName;
-  const char            *displayName;
-  SERVICE_STATUS_HANDLE statusHandle;
-  DWORD                 statusCheckpoint;
-  SERVICE_STATUS        status;
-  DWORD                 dwAcceptedControls;
-  bool                  debugging;
-
-public:
-  WindowsService(const char *p_serviceName, const char *p_displayName);
-  ~WindowsService(void);
-
-  BOOL  Install(const char *username, const char *password);
-  BOOL  Remove();
-  BOOL  Init();
-  BOOL  IsInstalled();
-  void  SetAcceptedControls(DWORD acceptedControls);
-  void  Debug(bool debugFlag) { debugging= debugFlag; }
-
-public:
-  static void WINAPI    ServiceMain(DWORD argc, LPTSTR *argv);
-  static void WINAPI    ControlHandler(DWORD CtrlType);
-
-protected:
-  virtual void Run(DWORD argc, LPTSTR *argv)= 0;
-  virtual void Stop()                 {}
-  virtual void Shutdown()             {}
-  virtual void Pause()                {}
-  virtual void Continue()             {}
-  virtual void Log(const char *msg)   {}
-
-  BOOL ReportStatus(DWORD currentStatus, DWORD waitHint= 3000, DWORD dwError=0);
-  void HandleControlCode(DWORD opcode);
-  void RegisterAndRun(DWORD argc, LPTSTR *argv);
-};
diff -Nrup a/server-tools/instance-manager/angel.cc b/server-tools/instance-manager/angel.cc
--- a/server-tools/instance-manager/angel.cc	2007-08-13 17:11:10 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,407 +0,0 @@
-/* Copyright (C) 2003-2006 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-#ifndef __WIN__
-
-#include "angel.h"
-
-#include <sys/wait.h>
-/*
-  sys/wait.h is needed for waitpid(). Unfortunately, there is no MySQL
-  include file, that can serve for this. Include it before MySQL system
-  headers so that we can change system defines if needed.
-*/
-
-#include "my_global.h"
-#include "my_alarm.h"
-#include "my_dir.h"
-#include "my_sys.h"
-
-/* Include other IM files. */
-
-#include "log.h"
-#include "manager.h"
-#include "options.h"
-#include "priv.h"
-
-/************************************************************************/
-
-enum { CHILD_OK= 0, CHILD_NEED_RESPAWN, CHILD_EXIT_ANGEL };
-
-static int log_fd;
-
-static volatile sig_atomic_t child_status= CHILD_OK;
-static volatile sig_atomic_t child_exit_code= 0;
-static volatile sig_atomic_t shutdown_request_signo= 0;
-
-
-/************************************************************************/
-/**
-  Open log file.
-
-  @return
-    TRUE  on error;
-    FALSE on success.
-*************************************************************************/
-
-static bool open_log_file()
-{
-  log_info("Angel: opening log file '%s'...",
-           (const char *) Options::Daemon::log_file_name);
-
-  log_fd= open(Options::Daemon::log_file_name,
-               O_WRONLY | O_CREAT | O_APPEND | O_NOCTTY,
-               S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
-
-  if (log_fd < 0)
-  {
-    log_error("Can not open log file '%s': %s.",
-              (const char *) Options::Daemon::log_file_name,
-              (const char *) strerror(errno));
-
-    return TRUE;
-  }
-
-  return FALSE;
-}
-
-
-/************************************************************************/
-/**
-  Detach the process from controlling tty.
-
-  @return
-    TRUE on error;
-    FALSE on success.
-*************************************************************************/
-
-static bool detach_process()
-{
-  /*
-    Become a session leader (the goal is not to have a controlling tty).
-
-    setsid() must succeed because child is guaranteed not to be a process
-    group leader (it belongs to the process group of the parent).
-
-    NOTE: if we now don't have a controlling tty we will not receive
-    tty-related signals - no need to ignore them.
-  */
-
-  if (setsid() < 0)
-  {
-    log_error("setsid() failed: %s.", (const char *) strerror(errno));
-    return -1;
-  }
-
-  /* Close STDIN. */
-
-  log_info("Angel: preparing standard streams.");
-
-  if (close(STDIN_FILENO) < 0)
-  {
-    log_error("Warning: can not close stdin (%s)."
-              "Trying to continue...",
-              (const char *) strerror(errno));
-  }
-
-  /* Dup STDOUT and STDERR to the log file. */
-
-  if (dup2(log_fd, STDOUT_FILENO) < 0 ||
-      dup2(log_fd, STDERR_FILENO) < 0)
-  {
-    log_error("Can not redirect stdout and stderr to the log file: %s.",
-              (const char *) strerror(errno));
-
-    return TRUE;
-  }
-
-  if (log_fd != STDOUT_FILENO && log_fd != STDERR_FILENO)
-  {
-    if (close(log_fd) < 0)
-    {
-      log_error("Can not close original log file handler (%d): %s. "
-                "Trying to continue...",
-                (int) log_fd,
-                (const char *) strerror(errno));
-    }
-  }
-
-  return FALSE;
-}
-
-
-/************************************************************************/
-/**
-  Create PID file.
-
-  @return
-    TRUE  on error;
-    FALSE on success.
-*************************************************************************/
-
-static bool create_pid_file()
-{
-  if (create_pid_file(Options::Daemon::angel_pid_file_name, getpid()))
-  {
-    log_error("Angel: can not create pid file (%s).",
-              (const char *) Options::Daemon::angel_pid_file_name);
-
-    return TRUE;
-  }
-
-  log_info("Angel: pid file (%s) created.",
-           (const char *) Options::Daemon::angel_pid_file_name);
-
-  return FALSE;
-}
-
-
-/************************************************************************/
-/**
-  SIGCHLD handler.
-
-  Reap child, analyze child exit code, and set child_status
-  appropriately.
-*************************************************************************/
-
-extern "C" void reap_child(int);
-
-void reap_child(int __attribute__((unused)) signo)
-{
-  /* NOTE: As we have only one child, no need to cycle waitpid(). */
-
-  int exit_code;
-
-  if (waitpid(0, &exit_code, WNOHANG) > 0)
-  {
-    child_exit_code= exit_code;
-    child_status= exit_code ? CHILD_NEED_RESPAWN : CHILD_EXIT_ANGEL;
-  }
-}
-
-
-/************************************************************************/
-/**
-  SIGTERM, SIGHUP, SIGINT handler.
-
-  Set termination status and return.
-*************************************************************************/
-
-extern "C" void terminate(int signo);
-void terminate(int signo)
-{
-  shutdown_request_signo= signo;
-}
-
-
-/************************************************************************/
-/**
-  Angel main loop.
-
-  @return
-    The function returns exit status for global main():
-      0  -- program completed successfully;
-      !0 -- error occurred.
-*************************************************************************/
-
-static int angel_main_loop()
-{
-  /*
-    Install signal handlers.
-
-    NOTE: Although signal handlers are needed only for parent process
-    (IM-angel), we should install them before fork() in order to avoid race
-    condition (i.e. to be sure, that IM-angel will receive SIGCHLD in any
-    case).
-  */
-
-  sigset_t wait_for_signals_mask;
-
-  struct sigaction sa_chld;
-  struct sigaction sa_term;
-  struct sigaction sa_chld_orig;
-  struct sigaction sa_term_orig;
-  struct sigaction sa_int_orig;
-  struct sigaction sa_hup_orig;
-
-  log_info("Angel: setting necessary signal actions...");
-
-  sigemptyset(&wait_for_signals_mask);
-
-  sigemptyset(&sa_chld.sa_mask);
-  sa_chld.sa_handler= reap_child;
-  sa_chld.sa_flags= SA_NOCLDSTOP;
-
-  sigemptyset(&sa_term.sa_mask);
-  sa_term.sa_handler= terminate;
-  sa_term.sa_flags= 0;
-
-  /* NOTE: sigaction() fails only if arguments are wrong. */
-
-  sigaction(SIGCHLD, &sa_chld, &sa_chld_orig);
-  sigaction(SIGTERM, &sa_term, &sa_term_orig);
-  sigaction(SIGINT, &sa_term, &sa_int_orig);
-  sigaction(SIGHUP, &sa_term, &sa_hup_orig);
-
-  /* The main Angel loop. */
-
-  while (true)
-  {
-    /* Spawn a new Manager. */
-
-    log_info("Angel: forking Manager process...");
-
-    switch (fork()) {
-    case -1:
-      log_error("Angel: can not fork IM-main: %s.",
-                (const char *) strerror(errno));
-
-      return -1;
-
-    case 0:
-      /*
-        We are in child process, which will be IM-main:
-          - Restore default signal actions to let the IM-main work with
-            signals as he wishes;
-          - Call Manager::main();
-      */
-
-      log_info("Angel: Manager process created successfully.");
-
-      /* NOTE: sigaction() fails only if arguments are wrong. */
-
-      sigaction(SIGCHLD, &sa_chld_orig, NULL);
-      sigaction(SIGTERM, &sa_term_orig, NULL);
-      sigaction(SIGINT, &sa_int_orig, NULL);
-      sigaction(SIGHUP, &sa_hup_orig, NULL);
-
-      log_info("Angel: executing Manager...");
-
-      return Manager::main();
-    }
-
-    /* Wait for signals. */
-
-    log_info("Angel: waiting for signals...");
-
-    while (child_status == CHILD_OK && shutdown_request_signo == 0)
-      sigsuspend(&wait_for_signals_mask);
-
-    /* Exit if one of shutdown signals has been caught. */
-
-    if (shutdown_request_signo)
-    {
-      log_info("Angel: received shutdown signal (%d). Exiting...",
-               (int) shutdown_request_signo);
-
-      return 0;
-    }
-
-    /* Manager process died. Respawn it if it was a failure. */
-
-    if (child_status == CHILD_NEED_RESPAWN)
-    {
-      child_status= CHILD_OK;
-
-      log_error("Angel: Manager exited abnormally (exit code: %d).",
-                (int) child_exit_code);
-
-      log_info("Angel: sleeping 1 second...");
-
-      sleep(1); /* don't respawn too fast */
-
-      log_info("Angel: respawning Manager...");
-
-      continue;
-    }
-
-    /* Delete IM-angel PID file. */
-
-    my_delete(Options::Daemon::angel_pid_file_name, MYF(0));
-
-    /* IM-angel finished. */
-
-    log_info("Angel: Manager exited normally. Exiting...");
-
-    return 0;
-  }
-}
-
-
-/************************************************************************/
-/**
-  Angel main function.
-
-  @return
-    The function returns exit status for global main():
-      0  -- program completed successfully;
-      !0 -- error occurred.
-*************************************************************************/
-
-int Angel::main()
-{
-  log_info("Angel: started.");
-
-  /* Open log file. */
-
-  if (open_log_file())
-    return -1;
-
-  /* Fork a new process. */
-
-  log_info("Angel: daemonizing...");
-
-  switch (fork()) {
-  case -1:
-    /*
-      This is the main Instance Manager process, fork() failed.
-      Log an error and bail out with error code.
-    */
-
-    log_error("fork() failed: %s.", (const char *) strerror(errno));
-    return -1;
-
-  case 0:
-    /* We are in child process. Continue Angel::main() execution. */
-
-    break;
-
-  default:
-    /*
-      We are in the parent process. Return 0 so that parent exits
-      successfully.
-    */
-
-    log_info("Angel: exiting from the original process...");
-
-    return 0;
-  }
-
-  /* Detach child from controlling tty. */
-
-  if (detach_process())
-    return -1;
-
-  /* Create PID file. */
-
-  if (create_pid_file())
-    return -1;
-
-  /* Start Angel main loop. */
-
-  return angel_main_loop();
-}
-
-#endif // __WIN__
diff -Nrup a/server-tools/instance-manager/angel.h b/server-tools/instance-manager/angel.h
--- a/server-tools/instance-manager/angel.h	2007-02-18 15:45:24 +03:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,34 +0,0 @@
-/* Copyright (C) 2003-2006 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-#ifndef INCLUDES_MYSQL_ANGEL_H
-#define INCLUDES_MYSQL_ANGEL_H
-
-#ifndef __WIN__
-
-#if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE)
-#pragma interface
-#endif
-
-#include <my_global.h>
-
-class Angel
-{
-public:
-  static int main();
-};
-
-#endif // INCLUDES_MYSQL_ANGEL_H
-#endif // __WIN__
diff -Nrup a/server-tools/instance-manager/buffer.cc b/server-tools/instance-manager/buffer.cc
--- a/server-tools/instance-manager/buffer.cc	2007-05-10 13:59:26 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,110 +0,0 @@
-/* Copyright (C) 2004 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-#if defined(__GNUC__) && defined(USE_PRAGMA_IMPLEMENTATION)
-#pragma implementation
-#endif
-
-#include "buffer.h"
-#include <m_string.h>
-
-const uint Buffer::BUFFER_INITIAL_SIZE= 4096;
-const uint Buffer::MAX_BUFFER_SIZE= 16777216;
-
-/*
-  Puts the given string to the buffer.
-
-  SYNOPSIS
-    append()
-    position          start position in the buffer
-    string            string to be put in the buffer
-    len_arg           the length of the string. This way we can avoid some
-                      strlens.
-
-  DESCRIPTION
-
-    The method puts a string into the buffer, starting from position .
-    In the case when the buffer is too small it reallocs the buffer. The
-    total size of the buffer is restricted with 16.
-
-  RETURN
-    0 - ok
-    1 - got an error in reserve()
-*/
-
-int Buffer::append(size_t position, const char *string, size_t len_arg)
-{
-  if (reserve(position, len_arg))
-    return 1;
-
-  strnmov((char*) buffer + position, string, len_arg);
-  return 0;
-}
-
-
-/*
-  Checks whether the current buffer size is ok to put a string of the length
-  "len_arg" starting from "position" and reallocs it if no.
-
-  SYNOPSIS
-    reserve()
-    position          the number starting byte on the buffer to store a buffer
-    len_arg           the length of the string.
-
-  DESCRIPTION
-
-    The method checks whether it is possible to put a string of the "len_arg"
-    length into the buffer, starting from "position" byte. In the case when the
-    buffer is too small it reallocs the buffer. The total size of the buffer is
-    restricted with 16 Mb.
-
-  RETURN
-    0 - ok
-    1 - realloc error or we have come to the 16Mb barrier
-*/
-
-int Buffer::reserve(size_t position, size_t len_arg)
-{
-  if (position + len_arg >= MAX_BUFFER_SIZE)
-    goto err;
-
-  if (position + len_arg >= buffer_size)
-  {
-    buffer= (uchar*) my_realloc(buffer,
-                                min(MAX_BUFFER_SIZE,
-                                    max((uint) (buffer_size*1.5),
-                                        position + len_arg)), MYF(0));
-    if (!(buffer))
-      goto err;
-    buffer_size= (size_t) (buffer_size*1.5);
-  }
-  return 0;
-
-err:
-  error= 1;
-  return 1;
-}
-
-
-int Buffer::get_size()
-{
-  return buffer_size;
-}
-
-
-int Buffer::is_error()
-{
-  return error;
-}
diff -Nrup a/server-tools/instance-manager/buffer.h b/server-tools/instance-manager/buffer.h
--- a/server-tools/instance-manager/buffer.h	2007-05-10 13:59:26 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,65 +0,0 @@
-#ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_BUFFER_H
-#define INCLUDES_MYSQL_INSTANCE_MANAGER_BUFFER_H
-/* Copyright (C) 2004 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-#include <my_global.h>
-#include <my_sys.h>
-
-#if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE)
-#pragma interface
-#endif
-
-/*
-  This class is a simple implementation of the buffer of varying size.
-  It is used to store MySQL client-server protocol packets. This is why
-  the maximum buffer size if 16Mb. (See internals manual section
-  7. MySQL Client/Server Protocol)
-*/
-
-class Buffer
-{
-private:
-  static const uint BUFFER_INITIAL_SIZE;
-  /* maximum buffer size is 16Mb */
-  static const uint MAX_BUFFER_SIZE;
-  size_t buffer_size;
-  /* Error flag. Triggered if we get an error of some kind */
-  int error;
-public:
-  Buffer(size_t buffer_size_arg= BUFFER_INITIAL_SIZE)
-    :buffer_size(buffer_size_arg), error(0)
-  {
-    /*
-      As append() will invokes realloc() anyway, it's ok if malloc returns 0
-    */
-    if (!(buffer= (uchar*) my_malloc(buffer_size, MYF(0))))
-        buffer_size= 0;
-  }
-
-  ~Buffer()
-  {
-    my_free(buffer, MYF(0));
-  }
-
-public:
-  uchar *buffer;
-  int get_size();
-  int is_error();
-  int append(size_t position, const char *string, size_t len_arg);
-  int reserve(size_t position, size_t len_arg);
-};
-
-#endif /* INCLUDES_MYSQL_INSTANCE_MANAGER_BUFFER_H */
diff -Nrup a/server-tools/instance-manager/command.cc b/server-tools/instance-manager/command.cc
--- a/server-tools/instance-manager/command.cc	2007-01-29 21:36:45 +03:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,30 +0,0 @@
-/* Copyright (C) 2004 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-#if defined(__GNUC__) && defined(USE_PRAGMA_IMPLEMENTATION)
-#pragma implementation
-#endif
-
-#include "manager.h"
-#include "command.h"
-
-Command::Command()
-  :guardian(Manager::get_guardian()),
-  instance_map(Manager::get_instance_map())
-{}
-
-Command::~Command()
-{}
-
diff -Nrup a/server-tools/instance-manager/command.h b/server-tools/instance-manager/command.h
--- a/server-tools/instance-manager/command.h	2006-12-23 22:19:47 +03:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,60 +0,0 @@
-#ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_COMMAND_H
-#define INCLUDES_MYSQL_INSTANCE_MANAGER_COMMAND_H
-/* Copyright (C) 2004 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-#include <my_global.h>
-
-#if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE)
-#pragma interface
-#endif
-
-/* Class responsible for allocation of IM commands. */
-
-class Guardian;
-class Instance_map;
-
-struct st_net;
-
-/*
-  Command - entry point for any command.
-  GangOf4: 'Command' design pattern
-*/
-
-class Command
-{
-public:
-  Command();
-  virtual ~Command();
-
-  /*
-    This operation incapsulates behaviour of the command.
-
-    SYNOPSIS
-      net             The network connection to the client.
-      connection_id   Client connection ID
-
-    RETURN
-      0               On success
-      non 0           On error. Client error code is returned.
-  */
-  virtual int execute(st_net *net, ulong connection_id) = 0;
-
-protected:
-  Guardian *guardian;
-  Instance_map *instance_map;
-};
-
-#endif /* INCLUDES_MYSQL_INSTANCE_MANAGER_COMMAND_H */
diff -Nrup a/server-tools/instance-manager/commands.cc b/server-tools/instance-manager/commands.cc
--- a/server-tools/instance-manager/commands.cc	2007-05-10 13:59:26 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,1752 +0,0 @@
-/* Copyright (C) 2004 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-#if defined(__GNUC__) && defined(USE_PRAGMA_IMPLEMENTATION)
-#pragma implementation
-#endif
-
-#include "commands.h"
-
-#include <my_global.h>
-#include <m_ctype.h>
-#include <mysql.h>
-#include <my_dir.h>
-
-#include "buffer.h"
-#include "guardian.h"
-#include "instance_map.h"
-#include "log.h"
-#include "manager.h"
-#include "messages.h"
-#include "mysqld_error.h"
-#include "mysql_manager_error.h"
-#include "options.h"
-#include "priv.h"
-#include "protocol.h"
-
-/**************************************************************************
- {{{ Static functions.
-**************************************************************************/
-
-/**
-  modify_defaults_to_im_error -- a map of error codes of
-  mysys::modify_defaults_file() into Instance Manager error codes.
-*/
-
-static const int modify_defaults_to_im_error[]= { 0, ER_OUT_OF_RESOURCES,
-                                                  ER_ACCESS_OPTION_FILE };
-
-
-/**
-  Parse version number from the version string.
-
-  SYNOPSIS
-    parse_version_number()
-    version_str
-    version
-    version_size
-
-  DESCRIPTION
-    TODO
-
-  TODO: Move this function to Instance_options and parse version number
-  only once.
-
-  NOTE: This function is used only in SHOW INSTANCE STATUS statement at the
-  moment.
-*/
-
-static int parse_version_number(const char *version_str, char *version,
-                                uint version_size)
-{
-  const char *start= version_str;
-  const char *end;
-
-  // skip garbage
-  while (!my_isdigit(default_charset_info, *start))
-    start++;
-
-  end= start;
-  // skip digits and dots
-  while (my_isdigit(default_charset_info, *end) || *end == '.')
-    end++;
-
-  if ((uint)(end - start) >= version_size)
-    return -1;
-
-  strncpy(version, start, end-start);
-  version[end-start]= '\0';
-
-  return 0;
-}
-
-/**************************************************************************
-  }}}
-**************************************************************************/
-
-/**************************************************************************
- Implementation of Instance_name.
-**************************************************************************/
-
-Instance_name::Instance_name(const LEX_STRING *name)
-{
-  str.str= str_buffer;
-  str.length= name->length;
-
-  if (str.length > MAX_INSTANCE_NAME_SIZE - 1)
-    str.length= MAX_INSTANCE_NAME_SIZE - 1;
-
-  strmake(str.str, name->str, str.length);
-}
-
-/**************************************************************************
- Implementation of Show_instances.
-**************************************************************************/
-
-/**
-  Implementation of SHOW INSTANCES statement.
-
-  Possible error codes:
-    ER_OUT_OF_RESOURCES         Not enough resources to complete the operation
-*/
-
-int Show_instances::execute(st_net *net, ulong /* connection_id */)
-{
-  int err_code;
-
-  if ((err_code= write_header(net)) ||
-      (err_code= write_data(net)))
-    return err_code;
-
-  if (send_eof(net) || net_flush(net))
-    return ER_OUT_OF_RESOURCES;
-
-  return 0;
-}
-
-
-int Show_instances::write_header(st_net *net)
-{
-  LIST name, state;
-  LEX_STRING name_field, state_field;
-  LIST *field_list;
-
-  name_field.str= (char *) "instance_name";
-  name_field.length= DEFAULT_FIELD_LENGTH;
-  name.data= &name_field;
-
-  state_field.str= (char *) "state";
-  state_field.length= DEFAULT_FIELD_LENGTH;
-  state.data= &state_field;
-
-  field_list= list_add(NULL, &state);
-  field_list= list_add(field_list, &name);
-
-  return send_fields(net, field_list) ? ER_OUT_OF_RESOURCES : 0;
-}
-
-
-int Show_instances::write_data(st_net *net)
-{
-  my_bool err_status= FALSE;
-
-  Instance *instance;
-  Instance_map::Iterator iterator(instance_map);
-
-  instance_map->lock();
-
-  while ((instance= iterator.next()))
-  {
-    Buffer send_buf;  /* buffer for packets */
-    size_t pos= 0;
-
-    instance->lock();
-
-    const char *instance_name= instance->options.instance_name.str;
-    const char *state_name= instance->get_state_name();
-
-    if (store_to_protocol_packet(&send_buf, instance_name, &pos) ||
-        store_to_protocol_packet(&send_buf, state_name, &pos) ||
-        my_net_write(net, send_buf.buffer, pos))
-    {
-      err_status= TRUE;
-    }
-
-    instance->unlock();
-
-    if (err_status)
-      break;
-  }
-
-  instance_map->unlock();
-
-  return err_status ? ER_OUT_OF_RESOURCES : 0;
-}
-
-
-/**************************************************************************
- Implementation of Flush_instances.
-**************************************************************************/
-
-/**
-  Implementation of FLUSH INSTANCES statement.
-
-  Possible error codes:
-    ER_OUT_OF_RESOURCES         Not enough resources to complete the operation
-    ER_THERE_IS_ACTIVE_INSTACE  If there is an active instance
-*/
-
-int Flush_instances::execute(st_net *net, ulong connection_id)
-{
-  int err_status= Manager::flush_instances();
-
-  if (err_status)
-    return err_status;
-
-  return net_send_ok(net, connection_id, NULL) ? ER_OUT_OF_RESOURCES : 0;
-}
-
-
-/**************************************************************************
- Implementation of Instance_cmd.
-**************************************************************************/
-
-Instance_cmd::Instance_cmd(const LEX_STRING *instance_name_arg):
-   instance_name(instance_name_arg)
-{
-  /*
-    MT-NOTE: we can not make a search for Instance object here,
-    because it can dissappear after releasing the lock.
-  */
-}
-
-
-/**************************************************************************
- Implementation of Abstract_instance_cmd.
-**************************************************************************/
-
-Abstract_instance_cmd::Abstract_instance_cmd(
-  const LEX_STRING *instance_name_arg)
-  :Instance_cmd(instance_name_arg)
-{
-}
-
-
-int Abstract_instance_cmd::execute(st_net *net, ulong connection_id)
-{
-  int err_code;
-  Instance *instance;
-
-  instance_map->lock();
-
-  instance= instance_map->find(get_instance_name());
-
-  if (!instance)
-  {
-    instance_map->unlock();
-    return ER_BAD_INSTANCE_NAME;
-  }
-
-  instance->lock();
-  instance_map->unlock();
-
-  err_code= execute_impl(net, instance);
-
-  instance->unlock();
-
-  if (!err_code)
-    err_code= send_ok_response(net, connection_id);
-
-  return err_code;
-}
-
-
-/**************************************************************************
- Implementation of Show_instance_status.
-**************************************************************************/
-
-Show_instance_status::Show_instance_status(const LEX_STRING *instance_name_arg)
-  :Abstract_instance_cmd(instance_name_arg)
-{
-}
-
-
-/**
-  Implementation of SHOW INSTANCE STATUS statement.
-
-  Possible error codes:
-    ER_BAD_INSTANCE_NAME        The instance with the given name does not exist
-    ER_OUT_OF_RESOURCES         Not enough resources to complete the operation
-*/
-
-int Show_instance_status::execute_impl(st_net *net, Instance *instance)
-{
-  int err_code;
-
-  if ((err_code= write_header(net)) ||
-      (err_code= write_data(net, instance)))
-    return err_code;
-
-  return 0;
-}
-
-
-int Show_instance_status::send_ok_response(st_net *net,
-                                           ulong /* connection_id */)
-{
-  if (send_eof(net) || net_flush(net))
-    return ER_OUT_OF_RESOURCES;
-
-  return 0;
-}
-
-
-int Show_instance_status::write_header(st_net *net)
-{
-  LIST name, state, version, version_number, mysqld_compatible;
-  LIST *field_list;
-  LEX_STRING name_field, state_field, version_field,
-                   version_number_field, mysqld_compatible_field;
-
-  /* Create list of the fileds to be passed to send_fields(). */
-
-  name_field.str= (char *) "instance_name";
-  name_field.length= DEFAULT_FIELD_LENGTH;
-  name.data= &name_field;
-
-  state_field.str= (char *) "state";
-  state_field.length= DEFAULT_FIELD_LENGTH;
-  state.data= &state_field;
-
-  version_field.str= (char *) "version";
-  version_field.length= MAX_VERSION_LENGTH;
-  version.data= &version_field;
-
-  version_number_field.str= (char *) "version_number";
-  version_number_field.length= MAX_VERSION_LENGTH;
-  version_number.data= &version_number_field;
-
-  mysqld_compatible_field.str= (char *) "mysqld_compatible";
-  mysqld_compatible_field.length= DEFAULT_FIELD_LENGTH;
-  mysqld_compatible.data= &mysqld_compatible_field;
-
-  field_list= list_add(NULL, &mysqld_compatible);
-  field_list= list_add(field_list, &version);
-  field_list= list_add(field_list, &version_number);
-  field_list= list_add(field_list, &state);
-  field_list= list_add(field_list, &name);
-
-  return send_fields(net, field_list) ? ER_OUT_OF_RESOURCES : 0;
-}
-
-
-int Show_instance_status::write_data(st_net *net, Instance *instance)
-{
-  Buffer send_buf;  /* buffer for packets */
-  char version_num_buf[MAX_VERSION_LENGTH];
-  size_t pos= 0;
-
-  const char *state_name= instance->get_state_name();
-  const char *version_tag= "unknown";
-  const char *version_num= "unknown";
-  const char *mysqld_compatible_status=
-    instance->is_mysqld_compatible() ? "yes" : "no";
-
-  if (instance->options.mysqld_version)
-  {
-    if (parse_version_number(instance->options.mysqld_version, version_num_buf,
-                             sizeof(version_num_buf)))
-      return ER_OUT_OF_RESOURCES;
-
-    version_num= version_num_buf;
-    version_tag= instance->options.mysqld_version;
-  }
-
-  if (store_to_protocol_packet(&send_buf, get_instance_name()->str, &pos) ||
-      store_to_protocol_packet(&send_buf, state_name, &pos) ||
-      store_to_protocol_packet(&send_buf, version_num, &pos) ||
-      store_to_protocol_packet(&send_buf, version_tag, &pos) ||
-      store_to_protocol_packet(&send_buf, mysqld_compatible_status, &pos) ||
-      my_net_write(net, send_buf.buffer, pos))
-  {
-    return ER_OUT_OF_RESOURCES;
-  }
-
-  return 0;
-}
-
-
-/**************************************************************************
- Implementation of Show_instance_options.
-**************************************************************************/
-
-Show_instance_options::Show_instance_options(
-  const LEX_STRING *instance_name_arg)
-  :Abstract_instance_cmd(instance_name_arg)
-{
-}
-
-
-/**
-  Implementation of SHOW INSTANCE OPTIONS statement.
-
-  Possible error codes:
-    ER_BAD_INSTANCE_NAME        The instance with the given name does not exist
-    ER_OUT_OF_RESOURCES         Not enough resources to complete the operation
-*/
-
-int Show_instance_options::execute_impl(st_net *net, Instance *instance)
-{
-  int err_code;
-
-  if ((err_code= write_header(net)) ||
-      (err_code= write_data(net, instance)))
-    return err_code;
-
-  return 0;
-}
-
-
-int Show_instance_options::send_ok_response(st_net *net,
-                                            ulong /* connection_id */)
-{
-  if (send_eof(net) || net_flush(net))
-    return ER_OUT_OF_RESOURCES;
-
-  return 0;
-}
-
-
-int Show_instance_options::write_header(st_net *net)
-{
-  LIST name, option;
-  LIST *field_list;
-  LEX_STRING name_field, option_field;
-
-  /* Create list of the fileds to be passed to send_fields(). */
-
-  name_field.str= (char *) "option_name";
-  name_field.length= DEFAULT_FIELD_LENGTH;
-  name.data= &name_field;
-
-  option_field.str= (char *) "value";
-  option_field.length= DEFAULT_FIELD_LENGTH;
-  option.data= &option_field;
-
-  field_list= list_add(NULL, &option);
-  field_list= list_add(field_list, &name);
-
-  return send_fields(net, field_list) ? ER_OUT_OF_RESOURCES : 0;
-}
-
-
-int Show_instance_options::write_data(st_net *net, Instance *instance)
-{
-  Buffer send_buff;  /* buffer for packets */
-  size_t pos= 0;
-
-  if (store_to_protocol_packet(&send_buff, "instance_name", &pos) ||
-      store_to_protocol_packet(&send_buff, get_instance_name()->str, &pos) ||
-      my_net_write(net, send_buff.buffer, pos))
-  {
-    return ER_OUT_OF_RESOURCES;
-  }
-
-  /* Loop through the options. */
-
-  for (int i= 0; i < instance->options.get_num_options(); i++)
-  {
-    Named_value option= instance->options.get_option(i);
-    const char *option_value= option.get_value()[0] ? option.get_value() : "";
-
-    pos= 0;
-
-    if (store_to_protocol_packet(&send_buff, option.get_name(), &pos) ||
-        store_to_protocol_packet(&send_buff, option_value, &pos) ||
-        my_net_write(net, send_buff.buffer, pos))
-    {
-      return ER_OUT_OF_RESOURCES;
-    }
-  }
-
-  return 0;
-}
-
-
-/**************************************************************************
- Implementation of Start_instance.
-**************************************************************************/
-
-Start_instance::Start_instance(const LEX_STRING *instance_name_arg)
-  :Abstract_instance_cmd(instance_name_arg)
-{
-}
-
-
-/**
-  Implementation of START INSTANCE statement.
-
-  Possible error codes:
-    ER_BAD_INSTANCE_NAME        The instance with the given name does not exist
-    ER_INSTANCE_MISCONFIGURED   The instance configuration is invalid
-    ER_INSTANCE_ALREADY_STARTED The instance is already started
-    ER_CANNOT_START_INSTANCE    The instance could not have been started
-
-  TODO: as soon as this method operates only with Instance, we probably
-  should introduce a new method (execute_stop_instance()) in Instance and
-  just call it from here.
-*/
-
-int Start_instance::execute_impl(st_net * /* net */, Instance *instance)
-{
-  if (!instance->is_configured())
-    return ER_INSTANCE_MISCONFIGURED;
-
-  if (instance->is_active())
-    return ER_INSTANCE_ALREADY_STARTED;
-
-  if (instance->start_mysqld())
-    return ER_CANNOT_START_INSTANCE;
-
-  instance->reset_stat();
-  instance->set_state(Instance::NOT_STARTED);
-
-  return 0;
-}
-
-
-int Start_instance::send_ok_response(st_net *net, ulong connection_id)
-{
-  if (net_send_ok(net, connection_id, "Instance started"))
-    return ER_OUT_OF_RESOURCES;
-
-  return 0;
-}
-
-
-/**************************************************************************
- Implementation of Stop_instance.
-**************************************************************************/
-
-Stop_instance::Stop_instance(const LEX_STRING *instance_name_arg)
-  :Abstract_instance_cmd(instance_name_arg)
-{
-}
-
-
-/**
-  Implementation of STOP INSTANCE statement.
-
-  Possible error codes:
-    ER_BAD_INSTANCE_NAME        The instance with the given name does not exist
-    ER_OUT_OF_RESOURCES         Not enough resources to complete the operation
-
-  TODO: as soon as this method operates only with Instance, we probably
-  should introduce a new method (execute_stop_instance()) in Instance and
-  just call it from here.
-*/
-
-int Stop_instance::execute_impl(st_net * /* net */, Instance *instance)
-{
-  if (!instance->is_active())
-    return ER_INSTANCE_IS_NOT_STARTED;
-
-  instance->set_state(Instance::STOPPED);
-
-  return instance->stop_mysqld() ? ER_STOP_INSTANCE : 0;
-}
-
-
-int Stop_instance::send_ok_response(st_net *net, ulong connection_id)
-{
-  if (net_send_ok(net, connection_id, NULL))
-    return ER_OUT_OF_RESOURCES;
-
-  return 0;
-}
-
-
-/**************************************************************************
- Implementation for Create_instance.
-**************************************************************************/
-
-Create_instance::Create_instance(const LEX_STRING *instance_name_arg)
-  :Instance_cmd(instance_name_arg)
-{
-}
-
-
-/**
-  This operation initializes Create_instance object.
-
-  SYNOPSIS
-    text            [IN/OUT] a pointer to the text containing instance options.
-
-  RETURN
-    FALSE           On success.
-    TRUE            On error.
-*/
-
-bool Create_instance::init(const char **text)
-{
-  return options.init() || parse_args(text);
-}
-
-
-/**
-  This operation parses CREATE INSTANCE options.
-
-  SYNOPSIS
-    text            [IN/OUT] a pointer to the text containing instance options.
-
-  RETURN
-    FALSE           On success.
-    TRUE            On syntax error.
-*/
-
-bool Create_instance::parse_args(const char **text)
-{
-  size_t len;
-
-  /* Check if we have something (and trim leading spaces). */
-
-  get_word(text, &len, NONSPACE);
-
-  if (len == 0)
-    return FALSE; /* OK: no option. */
-
-  /* Main parsing loop. */
-
-  while (TRUE)
-  {
-    LEX_STRING option_name;
-    char *option_name_str;
-    char *option_value_str= NULL;
-
-    /* Looking for option name. */
-
-    get_word(text, &option_name.length, OPTION_NAME);
-
-    if (option_name.length == 0)
-      return TRUE; /* Syntax error: option name expected. */
-
-    option_name.str= (char *) *text;
-    *text+= option_name.length;
-
-    /* Looking for equal sign. */
-
-    skip_spaces(text);
-
-    if (**text == '=')
-    {
-      ++(*text); /* Skip an equal sign. */
-
-      /* Looking for option value. */
-
-      skip_spaces(text);
-
-      if (!**text)
-        return TRUE; /* Syntax error: EOS when option value expected. */
-
-      if (**text != '\'' && **text != '"')
-      {
-        /* Option value is a simple token. */
-
-        LEX_STRING option_value;
-
-        get_word(text, &option_value.length, ALPHANUM);
-
-        if (option_value.length == 0)
-          return TRUE; /* internal parser error. */
-
-        option_value.str= (char *) *text;
-        *text+= option_value.length;
-
-        if (!(option_value_str= Named_value::alloc_str(&option_value)))
-          return TRUE; /* out of memory during parsing. */
-      }
-      else
-      {
-        /* Option value is a string. */
-
-        if (parse_option_value(*text, &len, &option_value_str))
-          return TRUE; /* Syntax error: invalid string specification. */
-
-        *text+= len;
-      }
-    }
-
-    if (!option_value_str)
-    {
-      LEX_STRING empty_str= { C_STRING_WITH_LEN("") };
-
-      if (!(option_value_str= Named_value::alloc_str(&empty_str)))
-        return TRUE; /* out of memory during parsing. */
-    }
-
-    if (!(option_name_str= Named_value::alloc_str(&option_name)))
-    {
-      Named_value::free_str(&option_value_str);
-      return TRUE; /* out of memory during parsing. */
-    }
-
-    {
-      Named_value option(option_name_str, option_value_str);
-
-      if (options.add_element(&option))
-      {
-        option.free();
-        return TRUE; /* out of memory during parsing. */
-      }
-    }
-
-    skip_spaces(text);
-
-    if (!**text)
-      return FALSE; /* OK: end of options. */
-
-    if (**text != ',')
-      return TRUE; /* Syntax error: comma expected. */
-
-    ++(*text);
-  }
-}
-
-
-/**
-  Implementation of CREATE INSTANCE statement.
-
-  Possible error codes:
-    ER_MALFORMED_INSTANCE_NAME  Instance name is malformed
-    ER_CREATE_EXISTING_INSTANCE There is an instance with the given name
-    ER_OUT_OF_RESOURCES         Not enough resources to complete the operation
-*/
-
-int Create_instance::execute(st_net *net, ulong connection_id)
-{
-  int err_code;
-  Instance *instance;
-
-  /* Check that the name is valid and there is no instance with such name. */
-
-  if (!Instance::is_name_valid(get_instance_name()))
-    return ER_MALFORMED_INSTANCE_NAME;
-
-  /*
-    NOTE: In order to prevent race condition, we should perform all operations
-    on under acquired lock.
-  */
-
-  instance_map->lock();
-
-  if (instance_map->find(get_instance_name()))
-  {
-    instance_map->unlock();
-    return ER_CREATE_EXISTING_INSTANCE;
-  }
-
-  if ((err_code= instance_map->create_instance(get_instance_name(), &options)))
-  {
-    instance_map->unlock();
-    return err_code;
-  }
-
-  instance= instance_map->find(get_instance_name());
-  DBUG_ASSERT(instance);
-
-  if ((err_code= create_instance_in_file(get_instance_name(), &options)))
-  {
-    instance_map->remove_instance(instance); /* instance is deleted here. */
-
-    instance_map->unlock();
-    return err_code;
-  }
-
-  /*
-    CREATE INSTANCE must not lead to start instance, even if it guarded.
-
-    TODO: The problem however is that if Instance Manager restarts after
-    creating instance, the instance will be restarted (see also BUG#19718).
-  */
-
-  instance->set_state(Instance::STOPPED);
-
-  /* That's all. */
-
-  instance_map->unlock();
-
-  /* Send the result. */
-
-  if (net_send_ok(net, connection_id, NULL))
-    return ER_OUT_OF_RESOURCES;
-
-  return 0;
-}
-
-
-/**************************************************************************
- Implementation for Drop_instance.
-**************************************************************************/
-
-Drop_instance::Drop_instance(const LEX_STRING *instance_name_arg)
-  :Instance_cmd(instance_name_arg)
-{
-}
-
-
-/**
-  Implementation of DROP INSTANCE statement.
-
-  Possible error codes:
-    ER_BAD_INSTANCE_NAME        The instance with the given name does not exist
-    ER_DROP_ACTIVE_INSTANCE     The specified instance is active
-    ER_OUT_OF_RESOURCES         Not enough resources to complete the operation
-*/
-
-int Drop_instance::execute(st_net *net, ulong connection_id)
-{
-  int err_code;
-  Instance *instance;
-
-  /* Lock Guardian, then Instance_map. */
-
-  instance_map->lock();
-
-  /* Find an instance. */
-
-  instance= instance_map->find(get_instance_name());
-
-  if (!instance)
-  {
-    instance_map->unlock();
-    return ER_BAD_INSTANCE_NAME;
-  }
-
-  instance->lock();
-
-  /* Check that the instance is offline. */
-
-  if (instance->is_active())
-  {
-    instance->unlock();
-    instance_map->unlock();
-
-    return ER_DROP_ACTIVE_INSTANCE;
-  }
-
-  /* Try to remove instance from the file. */
-
-  err_code= modify_defaults_file(Options::Main::config_file, NULL, NULL,
-                                 get_instance_name()->str, MY_REMOVE_SECTION);
-  DBUG_ASSERT(err_code >= 0 && err_code <= 2);
-
-  if (err_code)
-  {
-    log_error("Can not remove instance '%s' from defaults file (%s). "
-              "Original error code: %d.",
-              (const char *) get_instance_name()->str,
-              (const char *) Options::Main::config_file,
-              (int) err_code);
-
-    instance->unlock();
-    instance_map->unlock();
-
-    return modify_defaults_to_im_error[err_code];
-  }
-
-  /* Unlock the instance before destroy. */
-
-  instance->unlock();
-
-  /*
-    Remove instance from the instance map
-    (the instance will be also destroyed here).
-  */
-
-  instance_map->remove_instance(instance);
-
-  /* Unlock the instance map. */
-
-  instance_map->unlock();
-
-  /* That's all: send ok. */
-
-  if (net_send_ok(net, connection_id, "Instance dropped"))
-    return ER_OUT_OF_RESOURCES;
-
-  return 0;
-}
-
-
-/**************************************************************************
- Implementation for Show_instance_log.
-**************************************************************************/
-
-Show_instance_log::Show_instance_log(const LEX_STRING *instance_name_arg,
-                                     Log_type log_type_arg,
-                                     uint size_arg, uint offset_arg)
-  :Abstract_instance_cmd(instance_name_arg),
-  log_type(log_type_arg),
-  size(size_arg),
-  offset(offset_arg)
-{
-}
-
-
-/**
-  Implementation of SHOW INSTANCE LOG statement.
-
-  Possible error codes:
-    ER_BAD_INSTANCE_NAME        The instance with the given name does not exist
-    ER_OFFSET_ERROR             We were requested to read negative number of
-                                bytes from the log
-    ER_NO_SUCH_LOG              The specified type of log is not available for
-                                the given instance
-    ER_GUESS_LOGFILE            IM wasn't able to figure out the log
-                                placement, while it is enabled. Probably user
-                                should specify the path to the logfile
-                                explicitly.
-    ER_OPEN_LOGFILE             Cannot open the logfile
-    ER_READ_FILE                Cannot read the logfile
-    ER_OUT_OF_RESOURCES         Not enough resources to complete the operation
-*/
-
-int Show_instance_log::execute_impl(st_net *net, Instance *instance)
-{
-  int err_code;
-
-  if ((err_code= check_params(instance)))
-    return err_code;
-
-  if ((err_code= write_header(net)) ||
-      (err_code= write_data(net, instance)))
-    return err_code;
-
-  return 0;
-}
-
-
-int Show_instance_log::send_ok_response(st_net *net,
-                                        ulong /* connection_id */)
-{
-  if (send_eof(net) || net_flush(net))
-    return ER_OUT_OF_RESOURCES;
-
-  return 0;
-}
-
-
-int Show_instance_log::check_params(Instance *instance)
-{
-  const char *logpath= instance->options.logs[log_type];
-
-  /* Cannot read negative number of bytes. */
-
-  if (offset > size)
-    return ER_OFFSET_ERROR;
-
-  /* Instance has no such log. */
-
-  if (logpath == NULL)
-    return ER_NO_SUCH_LOG;
-
-  if (*logpath == '\0')
-    return ER_GUESS_LOGFILE;
-
-  return 0;
-}
-
-
-int Show_instance_log::write_header(st_net *net)
-{
-  LIST name;
-  LIST *field_list;
-  LEX_STRING name_field;
-
-  /* Create list of the fields to be passed to send_fields(). */
-
-  name_field.str= (char *) "Log";
-  name_field.length= DEFAULT_FIELD_LENGTH;
-
-  name.data= &name_field;
-
-  field_list= list_add(NULL, &name);
-
-  return send_fields(net, field_list) ? ER_OUT_OF_RESOURCES : 0;
-}
-
-
-int Show_instance_log::write_data(st_net *net, Instance *instance)
-{
-  Buffer send_buff;  /* buffer for packets */
-  size_t pos= 0;
-
-  const char *logpath= instance->options.logs[log_type];
-  File fd;
-
-  size_t buff_size;
-  size_t read_len;
-
-  MY_STAT file_stat;
-  Buffer read_buff;
-
-  if ((fd= my_open(logpath, O_RDONLY | O_BINARY,  MYF(MY_WME))) <= 0)
-    return ER_OPEN_LOGFILE;
-
-  /* my_fstat doesn't use the flag parameter */
-  if (my_fstat(fd, &file_stat, MYF(0)))
-  {
-    close(fd);
-    return ER_OUT_OF_RESOURCES;
-  }
-
-  /* calculate buffer size */
-  buff_size= (size - offset);
-
-  read_buff.reserve(0, buff_size);
-
-  /* read in one chunk */
-  read_len= (int)my_seek(fd, file_stat.st_size - size, MY_SEEK_SET, MYF(0));
-
-  if ((read_len= my_read(fd, read_buff.buffer, buff_size, MYF(0))) ==
-      MY_FILE_ERROR)
-  {
-    close(fd);
-    return ER_READ_FILE;
-  }
-
-  close(fd);
-
-  if (store_to_protocol_packet(&send_buff, (char*) read_buff.buffer, &pos,
-                               read_len) ||
-      my_net_write(net, send_buff.buffer, pos))
-  {
-    return ER_OUT_OF_RESOURCES;
-  }
-
-  return 0;
-}
-
-
-/**************************************************************************
- Implementation of Show_instance_log_files.
-**************************************************************************/
-
-Show_instance_log_files::Show_instance_log_files
-              (const LEX_STRING *instance_name_arg)
-  :Abstract_instance_cmd(instance_name_arg)
-{
-}
-
-
-/**
-  Implementation of SHOW INSTANCE LOG FILES statement.
-
-  Possible error codes:
-    ER_BAD_INSTANCE_NAME        The instance with the given name does not exist
-    ER_OUT_OF_RESOURCES         Not enough resources to complete the operation
-*/
-
-int Show_instance_log_files::execute_impl(st_net *net, Instance *instance)
-{
-  int err_code;
-
-  if ((err_code= write_header(net)) ||
-      (err_code= write_data(net, instance)))
-    return err_code;
-
-  return 0;
-}
-
-
-int Show_instance_log_files::send_ok_response(st_net *net,
-                                              ulong /* connection_id */)
-{
-  if (send_eof(net) || net_flush(net))
-    return ER_OUT_OF_RESOURCES;
-
-  return 0;
-}
-
-
-int Show_instance_log_files::write_header(st_net *net)
-{
-  LIST name, path, size;
-  LIST *field_list;
-  LEX_STRING name_field, path_field, size_field;
-
-  /* Create list of the fileds to be passed to send_fields(). */
-
-  name_field.str= (char *) "Logfile";
-  name_field.length= DEFAULT_FIELD_LENGTH;
-  name.data= &name_field;
-
-  path_field.str= (char *) "Path";
-  path_field.length= DEFAULT_FIELD_LENGTH;
-  path.data= &path_field;
-
-  size_field.str= (char *) "File size";
-  size_field.length= DEFAULT_FIELD_LENGTH;
-  size.data= &size_field;
-
-  field_list= list_add(NULL, &size);
-  field_list= list_add(field_list, &path);
-  field_list= list_add(field_list, &name);
-
-  return send_fields(net, field_list) ? ER_OUT_OF_RESOURCES : 0;
-}
-
-
-int Show_instance_log_files::write_data(st_net *net, Instance *instance)
-{
-  Buffer send_buff;  /* buffer for packets */
-
-  /*
-    We have alike structure in instance_options.cc. We use such to be able
-    to loop through the options, which we need to handle in some common way.
-  */
-  struct log_files_st
-  {
-    const char *name;
-    const char *value;
-  } logs[]=
-  {
-    {"ERROR LOG", instance->options.logs[IM_LOG_ERROR]},
-    {"GENERAL LOG", instance->options.logs[IM_LOG_GENERAL]},
-    {"SLOW LOG", instance->options.logs[IM_LOG_SLOW]},
-    {NULL, NULL}
-  };
-  struct log_files_st *log_files;
-
-  for (log_files= logs; log_files->name; log_files++)
-  {
-    if (!log_files->value)
-      continue;
-
-    struct stat file_stat;
-    /*
-      Save some more space for the log file names. In fact all
-      we need is strlen("GENERAL_LOG") + 1
-    */
-    enum { LOG_NAME_BUFFER_SIZE= 20 };
-    char buff[LOG_NAME_BUFFER_SIZE];
-
-    size_t pos= 0;
-
-    const char *log_path= "";
-    const char *log_size= "0";
-
-    if (!stat(log_files->value, &file_stat) &&
-        MY_S_ISREG(file_stat.st_mode))
-    {
-      int10_to_str(file_stat.st_size, buff, 10);
-
-      log_path= log_files->value;
-      log_size= buff;
-    }
-
-    if (store_to_protocol_packet(&send_buff, log_files->name, &pos) ||
-        store_to_protocol_packet(&send_buff, log_path, &pos) ||
-        store_to_protocol_packet(&send_buff, log_size, &pos) ||
-        my_net_write(net, send_buff.buffer, pos))
-      return ER_OUT_OF_RESOURCES;
-  }
-
-  return 0;
-}
-
-
-/**************************************************************************
- Implementation of Abstract_option_cmd.
-**************************************************************************/
-
-/**
-  Instance_options_list -- a data class representing a list of options for
-  some instance.
-*/
-
-class Instance_options_list
-{
-public:
-  Instance_options_list(const LEX_STRING *instance_name_arg);
-
-public:
-  bool init();
-
-  const LEX_STRING *get_instance_name() const
-  {
-    return instance_name.get_str();
-  }
-
-public:
-  /*
-    This member is set and used only in Abstract_option_cmd::execute_impl().
-    Normally it is not used (and should not).
-
-    The problem is that construction and execution of commands are made not
-    in one transaction (not under one lock session). So, we can not initialize
-    instance in constructor and use it in execution.
-  */
-  Instance *instance;
-
-  Named_value_arr options;
-
-private:
-  Instance_name instance_name;
-};
-
-
-/**************************************************************************/
-
-Instance_options_list::Instance_options_list(
-  const LEX_STRING *instance_name_arg)
-  :instance(NULL),
-  instance_name(instance_name_arg)
-{
-}
-
-
-bool Instance_options_list::init()
-{
-  return options.init();
-}
-
-
-/**************************************************************************/
-
-C_MODE_START
-
-static uchar* get_item_key(const uchar* item, size_t* len,
-                           my_bool __attribute__((unused)) t)
-{
-  const Instance_options_list *lst= (const Instance_options_list *) item;
-  *len= lst->get_instance_name()->length;
-  return (uchar *) lst->get_instance_name()->str;
-}
-
-static void delete_item(void *item)
-{
-  delete (Instance_options_list *) item;
-}
-
-C_MODE_END
-
-
-/**************************************************************************/
-
-Abstract_option_cmd::Abstract_option_cmd()
-  :initialized(FALSE)
-{
-}
-
-
-Abstract_option_cmd::~Abstract_option_cmd()
-{
-  if (initialized)
-    hash_free(&instance_options_map);
-}
-
-
-bool Abstract_option_cmd::add_option(const LEX_STRING *instance_name,
-                                     Named_value *option)
-{
-  Instance_options_list *lst= get_instance_options_list(instance_name);
-
-  if (!lst)
-    return TRUE;
-
-  lst->options.add_element(option);
-
-  return FALSE;
-}
-
-
-bool Abstract_option_cmd::init(const char **text)
-{
-  static const int INITIAL_HASH_SIZE= 16;
-
-  if (hash_init(&instance_options_map, default_charset_info,
-                INITIAL_HASH_SIZE, 0, 0, get_item_key, delete_item, 0))
-    return TRUE;
-
-  if (parse_args(text))
-    return TRUE;
-
-  initialized= TRUE;
-
-  return FALSE;
-}
-
-
-/**
-  Correct the option file. The "skip" option is used to remove the found
-  option.
-
-  SYNOPSIS
-  Abstract_option_cmd::correct_file()
-    skip     Skip the option, being searched while writing the result file.
-             That is, to delete it.
-
-  RETURN
-    0                       Success
-    ER_OUT_OF_RESOURCES     Not enough resources to complete the operation
-    ER_ACCESS_OPTION_FILE   Cannot access the option file
-*/
-
-int Abstract_option_cmd::correct_file(Instance *instance, Named_value *option,
-                                      bool skip)
-{
-  int err_code= modify_defaults_file(Options::Main::config_file,
-                                     option->get_name(),
-                                     option->get_value(),
-                                     instance->get_name()->str,
-                                     skip);
-
-  DBUG_ASSERT(err_code >= 0 && err_code <= 2);
-
-  if (err_code)
-  {
-    log_error("Can not modify option (%s) in defaults file (%s). "
-              "Original error code: %d.",
-              (const char *) option->get_name(),
-              (const char *) Options::Main::config_file,
-              (int) err_code);
-  }
-
-  return modify_defaults_to_im_error[err_code];
-}
-
-
-/**
-  Lock Instance Map and call execute_impl().
-
-  Possible error codes:
-    ER_BAD_INSTANCE_NAME        The instance with the given name does not exist
-    ER_INCOMPATIBLE_OPTION      The specified option can not be set for
-                                mysqld-compatible instance
-    ER_INSTANCE_IS_ACTIVE       The specified instance is active
-    ER_OUT_OF_RESOURCES         Not enough resources to complete the operation
-*/
-
-int Abstract_option_cmd::execute(st_net *net, ulong connection_id)
-{
-  int err_code;
-
-  instance_map->lock();
-
-  err_code= execute_impl(net, connection_id);
-
-  instance_map->unlock();
-
-  return err_code;
-}
-
-
-Instance_options_list *
-Abstract_option_cmd::get_instance_options_list(const LEX_STRING *instance_name)
-{
-  Instance_options_list *lst=
-    (Instance_options_list *) hash_search(&instance_options_map,
-                                        (uchar *) instance_name->str,
-                                        instance_name->length);
-
-  if (!lst)
-  {
-    lst= new Instance_options_list(instance_name);
-
-    if (!lst)
-      return NULL;
-
-    if (lst->init() || my_hash_insert(&instance_options_map, (uchar *) lst))
-    {
-      delete lst;
-      return NULL;
-    }
-  }
-
-  return lst;
-}
-
-
-/**
-  Skeleton implementation of option-management command.
-
-  MT-NOTE: Instance Map is locked before calling this operation.
-*/
-int Abstract_option_cmd::execute_impl(st_net *net, ulong connection_id)
-{
-  int err_code= 0;
-
-  /* Check that all the specified instances exist and are offline. */
-
-  for (uint i= 0; i < instance_options_map.records; ++i)
-  {
-    Instance_options_list *lst=
-      (Instance_options_list *) hash_element(&instance_options_map, i);
-
-    bool instance_is_active;
-
-    lst->instance= instance_map->find(lst->get_instance_name());
-
-    if (!lst->instance)
-      return ER_BAD_INSTANCE_NAME;
-
-    lst->instance->lock();
-    instance_is_active= lst->instance->is_active();
-    lst->instance->unlock();
-
-    if (instance_is_active)
-      return ER_INSTANCE_IS_ACTIVE;
-  }
-
-  /* Perform command-specific (SET/UNSET) actions. */
-
-  for (uint i= 0; i < instance_options_map.records; ++i)
-  {
-    Instance_options_list *lst=
-      (Instance_options_list *) hash_element(&instance_options_map, i);
-
-    lst->instance->lock();
-
-    for (int j= 0; j < lst->options.get_size(); ++j)
-    {
-      Named_value option= lst->options.get_element(j);
-      err_code= process_option(lst->instance, &option);
-
-      if (err_code)
-        break;
-    }
-
-    lst->instance->unlock();
-
-    if (err_code)
-      break;
-  }
-
-  if (err_code == 0)
-    net_send_ok(net, connection_id, NULL);
-
-  return err_code;
-}
-
-
-/**************************************************************************
- Implementation of Set_option.
-**************************************************************************/
-
-/**
-  This operation parses SET options.
-
-  SYNOPSIS
-    text            [IN/OUT] a pointer to the text containing options.
-
-  RETURN
-    FALSE           On success.
-    TRUE            On syntax error.
-*/
-
-bool Set_option::parse_args(const char **text)
-{
-  size_t len;
-
-  /* Check if we have something (and trim leading spaces). */
-
-  get_word(text, &len, NONSPACE);
-
-  if (len == 0)
-    return TRUE; /* Syntax error: no option. */
-
-  /* Main parsing loop. */
-
-  while (TRUE)
-  {
-    LEX_STRING instance_name;
-    LEX_STRING option_name;
-    char *option_name_str;
-    char *option_value_str= NULL;
-
-    /* Looking for instance name. */
-
-    get_word(text, &instance_name.length, ALPHANUM);
-
-    if (instance_name.length == 0)
-      return TRUE; /* Syntax error: instance name expected. */
-
-    instance_name.str= (char *) *text;
-    *text+= instance_name.length;
-
-    skip_spaces(text);
-
-    /* Check the the delimiter is a dot. */
-
-    if (**text != '.')
-      return TRUE; /* Syntax error: dot expected. */
-
-    ++(*text);
-
-    /* Looking for option name. */
-
-    get_word(text, &option_name.length, OPTION_NAME);
-
-    if (option_name.length == 0)
-      return TRUE; /* Syntax error: option name expected. */
-
-    option_name.str= (char *) *text;
-    *text+= option_name.length;
-
-    /* Looking for equal sign. */
-
-    skip_spaces(text);
-
-    if (**text == '=')
-    {
-      ++(*text); /* Skip an equal sign. */
-
-      /* Looking for option value. */
-
-      skip_spaces(text);
-
-      if (!**text)
-        return TRUE; /* Syntax error: EOS when option value expected. */
-
-      if (**text != '\'' && **text != '"')
-      {
-        /* Option value is a simple token. */
-
-        LEX_STRING option_value;
-
-        get_word(text, &option_value.length, ALPHANUM);
-
-        if (option_value.length == 0)
-          return TRUE; /* internal parser error. */
-
-        option_value.str= (char *) *text;
-        *text+= option_value.length;
-
-        if (!(option_value_str= Named_value::alloc_str(&option_value)))
-          return TRUE; /* out of memory during parsing. */
-      }
-      else
-      {
-        /* Option value is a string. */
-
-        if (parse_option_value(*text, &len, &option_value_str))
-          return TRUE; /* Syntax error: invalid string specification. */
-
-        *text+= len;
-      }
-    }
-
-    if (!option_value_str)
-    {
-      LEX_STRING empty_str= { C_STRING_WITH_LEN("") };
-
-      if (!(option_value_str= Named_value::alloc_str(&empty_str)))
-        return TRUE; /* out of memory during parsing. */
-    }
-
-    if (!(option_name_str= Named_value::alloc_str(&option_name)))
-    {
-      Named_value::free_str(&option_name_str);
-      return TRUE; /* out of memory during parsing. */
-    }
-
-    {
-      Named_value option(option_name_str, option_value_str);
-
-      if (add_option(&instance_name, &option))
-      {
-        option.free();
-        return TRUE; /* out of memory during parsing. */
-      }
-    }
-
-    skip_spaces(text);
-
-    if (!**text)
-      return FALSE; /* OK: end of options. */
-
-    if (**text != ',')
-      return TRUE; /* Syntax error: comma expected. */
-
-    ++(*text); /* Skip a comma. */
-  }
-}
-
-
-int Set_option::process_option(Instance *instance, Named_value *option)
-{
-  /* Check that the option is valid. */
-
-  if (instance->is_mysqld_compatible() &&
-      Instance_options::is_option_im_specific(option->get_name()))
-  {
-      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);
-      return ER_INCOMPATIBLE_OPTION;
-  }
-
-  /* Update the configuration file. */
-
-  int err_code= correct_file(instance, option, FALSE);
-
-  if (err_code)
-    return err_code;
-
-  /* Update the internal cache. */
-
-  if (instance->options.set_option(option))
-    return ER_OUT_OF_RESOURCES;
-
-  return 0;
-}
-
-
-/**************************************************************************
- Implementation of Unset_option.
-**************************************************************************/
-
-/**
-  This operation parses UNSET options.
-
-  SYNOPSIS
-    text            [IN/OUT] a pointer to the text containing options.
-
-  RETURN
-    FALSE           On success.
-    TRUE            On syntax error.
-*/
-
-bool Unset_option::parse_args(const char **text)
-{
-  size_t len;
-
-  /* Check if we have something (and trim leading spaces). */
-
-  get_word(text, &len, NONSPACE);
-
-  if (len == 0)
-    return TRUE; /* Syntax error: no option. */
-
-  /* Main parsing loop. */
-
-  while (TRUE)
-  {
-    LEX_STRING instance_name;
-    LEX_STRING option_name;
-    char *option_name_str;
-    char *option_value_str;
-
-    /* Looking for instance name. */
-
-    get_word(text, &instance_name.length, ALPHANUM);
-
-    if (instance_name.length == 0)
-      return TRUE; /* Syntax error: instance name expected. */
-
-    instance_name.str= (char *) *text;
-    *text+= instance_name.length;
-
-    skip_spaces(text);
-
-    /* Check the the delimiter is a dot. */
-
-    if (**text != '.')
-      return TRUE; /* Syntax error: dot expected. */
-
-    ++(*text); /* Skip a dot. */
-
-    /* Looking for option name. */
-
-    get_word(text, &option_name.length, OPTION_NAME);
-
-    if (option_name.length == 0)
-      return TRUE; /* Syntax error: option name expected. */
-
-    option_name.str= (char *) *text;
-    *text+= option_name.length;
-
-    if (!(option_name_str= Named_value::alloc_str(&option_name)))
-      return TRUE; /* out of memory during parsing. */
-
-    {
-      LEX_STRING empty_str= { C_STRING_WITH_LEN("") };
-
-      if (!(option_value_str= Named_value::alloc_str(&empty_str)))
-      {
-        Named_value::free_str(&option_name_str);
-        return TRUE;
-      }
-    }
-
-    {
-      Named_value option(option_name_str, option_value_str);
-
-      if (add_option(&instance_name, &option))
-      {
-        option.free();
-        return TRUE; /* out of memory during parsing. */
-      }
-    }
-
-    skip_spaces(text);
-
-    if (!**text)
-      return FALSE; /* OK: end of options. */
-
-    if (**text != ',')
-      return TRUE; /* Syntax error: comma expected. */
-
-    ++(*text); /* Skip a comma. */
-  }
-}
-
-
-/**
-  Implementation of UNSET statement.
-
-  Possible error codes:
-    ER_BAD_INSTANCE_NAME        The instance name specified is not valid
-    ER_INSTANCE_IS_ACTIVE       The specified instance is active
-    ER_OUT_OF_RESOURCES         Not enough resources to complete the operation
-*/
-
-int Unset_option::process_option(Instance *instance, Named_value *option)
-{
-  /* Update the configuration file. */
-
-  int err_code= correct_file(instance, option, TRUE);
-
-  if (err_code)
-    return err_code;
-
-  /* Update the internal cache. */
-
-  instance->options.unset_option(option->get_name());
-
-  return 0;
-}
-
-
-/**************************************************************************
- Implementation of Syntax_error.
-**************************************************************************/
-
-int Syntax_error::execute(st_net * /* net */, ulong /* connection_id */)
-{
-  return ER_SYNTAX_ERROR;
-}
diff -Nrup a/server-tools/instance-manager/commands.h b/server-tools/instance-manager/commands.h
--- a/server-tools/instance-manager/commands.h	2007-01-27 04:46:39 +03:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,393 +0,0 @@
-#ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_COMMANDS_H
-#define INCLUDES_MYSQL_INSTANCE_MANAGER_COMMANDS_H
-/* Copyright (C) 2004 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-#include <my_global.h>
-#include <my_sys.h>
-#include <m_string.h>
-#include <hash.h>
-
-#include "command.h"
-#include "instance.h"
-#include "parse.h"
-
-#if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE)
-#pragma interface
-#endif
-
-
-/**
-  Print all instances of this instance manager.
-  Grammar: SHOW INSTANCES
-*/
-
-class Show_instances: public Command
-{
-public:
-  Show_instances()
-  { }
-
-public:
-  int execute(st_net *net, ulong connection_id);
-
-private:
-  int write_header(st_net *net);
-  int write_data(st_net *net);
-};
-
-
-/**
-  Reread configuration file and refresh internal cache.
-  Grammar: FLUSH INSTANCES
-*/
-
-class Flush_instances: public Command
-{
-public:
-  Flush_instances()
-  { }
-
-public:
-  int execute(st_net *net, ulong connection_id);
-};
-
-
-/**
-  Base class for Instance-specific commands
-  (commands that operate on one instance).
-
-  Instance_cmd extends Command class by:
-    - an attribute for storing instance name;
-    - code to initialize instance name in constructor;
-    - an accessor to get instance name.
-*/
-
-class Instance_cmd : public Command
-{
-public:
-  Instance_cmd(const LEX_STRING *instance_name_arg);
-
-protected:
-  inline const LEX_STRING *get_instance_name() const
-  {
-    return instance_name.get_str();
-  }
-
-private:
-  Instance_name instance_name;
-};
-
-
-/**
-  Abstract class for Instance-specific commands.
-
-  Abstract_instance_cmd extends Instance_cmd by providing a common
-  framework for writing command-implementations. Basically, the class
-  implements Command::execute() pure virtual function in the following
-  way:
-    - Lock Instance_map;
-    - Get an instance by name. Return an error, if there is no such
-      instance;
-    - Lock the instance;
-    - Unlock Instance_map;
-    - Call execute_impl(), which should be implemented in derived class;
-    - Unlock the instance;
-    - Send response to the client and return error status.
-*/
-
-class Abstract_instance_cmd: public Instance_cmd
-{
-public:
-  Abstract_instance_cmd(const LEX_STRING *instance_name_arg);
-
-public:
-  virtual int execute(st_net *net, ulong connection_id);
-
-protected:
-  /**
-    This operation is intended to contain command-specific implementation.
-
-    MT-NOTE: this operation is called under acquired Instance's lock.
-  */
-  virtual int execute_impl(st_net *net, Instance *instance) = 0;
-
-  /**
-    This operation is invoked on successful return of execute_impl() and is
-    intended to send closing data.
-
-    MT-NOTE: this operation is called under released Instance's lock.
-  */
-  virtual int send_ok_response(st_net *net, ulong connection_id) = 0;
-};
-
-
-/**
-  Print status of an instance.
-  Grammar: SHOW INSTANCE STATUS <instance_name>
-*/
-
-class Show_instance_status: public Abstract_instance_cmd
-{
-public:
-  Show_instance_status(const LEX_STRING *instance_name_arg);
-
-protected:
-  virtual int execute_impl(st_net *net, Instance *instance);
-  virtual int send_ok_response(st_net *net, ulong connection_id);
-
-private:
-  int write_header(st_net *net);
-  int write_data(st_net *net, Instance *instance);
-};
-
-
-/**
-  Print options of chosen instance.
-  Grammar: SHOW INSTANCE OPTIONS <instance_name>
-*/
-
-class Show_instance_options: public Abstract_instance_cmd
-{
-public:
-  Show_instance_options(const LEX_STRING *instance_name_arg);
-
-protected:
-  virtual int execute_impl(st_net *net, Instance *instance);
-  virtual int send_ok_response(st_net *net, ulong connection_id);
-
-private:
-  int write_header(st_net *net);
-  int write_data(st_net *net, Instance *instance);
-};
-
-
-/**
-  Start an instance.
-  Grammar: START INSTANCE <instance_name>
-*/
-
-class Start_instance: public Abstract_instance_cmd
-{
-public:
-  Start_instance(const LEX_STRING *instance_name_arg);
-
-protected:
-  virtual int execute_impl(st_net *net, Instance *instance);
-  virtual int send_ok_response(st_net *net, ulong connection_id);
-};
-
-
-/**
-  Stop an instance.
-  Grammar: STOP INSTANCE <instance_name>
-*/
-
-class Stop_instance: public Abstract_instance_cmd
-{
-public:
-  Stop_instance(const LEX_STRING *instance_name_arg);
-
-protected:
-  virtual int execute_impl(st_net *net, Instance *instance);
-  virtual int send_ok_response(st_net *net, ulong connection_id);
-};
-
-
-/**
-  Create an instance.
-  Grammar: CREATE INSTANCE <instance_name> [<options>]
-*/
-
-class Create_instance: public Instance_cmd
-{
-public:
-  Create_instance(const LEX_STRING *instance_name_arg);
-
-public:
-  bool init(const char **text);
-
-protected:
-  virtual int execute(st_net *net, ulong connection_id);
-
-private:
-  bool parse_args(const char **text);
-
-private:
-  Named_value_arr options;
-};
-
-
-/**
-  Drop an instance.
-  Grammar: DROP INSTANCE <instance_name>
-
-  Operation is permitted only if the instance is stopped. On successful
-  completion the instance section is removed from config file and the instance
-  is removed from the instance map.
-*/
-
-class Drop_instance: public Instance_cmd
-{
-public:
-  Drop_instance(const LEX_STRING *instance_name_arg);
-
-protected:
-  virtual int execute(st_net *net, ulong connection_id);
-};
-
-
-/**
-  Print requested part of the log.
-  Grammar:
-    SHOW <instance_name> LOG {ERROR | SLOW | GENERAL} size[, offset_from_end]
-*/
-
-class Show_instance_log: public Abstract_instance_cmd
-{
-public:
-  Show_instance_log(const LEX_STRING *instance_name_arg,
-                    Log_type log_type_arg, uint size_arg, uint offset_arg);
-
-protected:
-  virtual int execute_impl(st_net *net, Instance *instance);
-  virtual int send_ok_response(st_net *net, ulong connection_id);
-
-private:
-  int check_params(Instance *instance);
-  int write_header(st_net *net);
-  int write_data(st_net *net, Instance *instance);
-
-private:
-  Log_type log_type;
-  uint size;
-  uint offset;
-};
-
-
-/**
-  Shows the list of the log files, used by an instance.
-  Grammar: SHOW <instance_name> LOG FILES
-*/
-
-class Show_instance_log_files: public Abstract_instance_cmd
-{
-public:
-  Show_instance_log_files(const LEX_STRING *instance_name_arg);
-
-protected:
-  virtual int execute_impl(st_net *net, Instance *instance);
-  virtual int send_ok_response(st_net *net, ulong connection_id);
-
-private:
-  int write_header(st_net *net);
-  int write_data(st_net *net, Instance *instance);
-};
-
-
-/**
-  Abstract class for option-management commands.
-*/
-
-class Instance_options_list;
-
-class Abstract_option_cmd: public Command
-{
-public:
-  ~Abstract_option_cmd();
-
-public:
-  bool add_option(const LEX_STRING *instance_name, Named_value *option);
-
-public:
-  bool init(const char **text);
-
-  virtual int execute(st_net *net, ulong connection_id);
-
-protected:
-  Abstract_option_cmd();
-
-  int correct_file(Instance *instance, Named_value *option, bool skip);
-
-protected:
-  virtual bool parse_args(const char **text) = 0;
-  virtual int process_option(Instance *instance, Named_value *option) = 0;
-
-private:
-  Instance_options_list *
-  get_instance_options_list(const LEX_STRING *instance_name);
-
-  int execute_impl(st_net *net, ulong connection_id);
-
-private:
-  HASH instance_options_map;
-  bool initialized;
-};
-
-
-/**
-  Set an option for the instance.
-  Grammar: SET instance_name.option[=option_value][, ...]
-*/
-
-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);
-};
-
-
-/**
-  Remove option of the instance.
-  Grammar: UNSET instance_name.option[, ...]
-*/
-
-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);
-};
-
-
-/**
-  Syntax error command.
-
-  This command is issued if parser reported a syntax error. We need it to
-  distinguish between syntax error and internal parser error.  E.g. parsing
-  failed because we hadn't had enought memory. In the latter case the parser
-  just returns NULL.
-*/
-
-class Syntax_error: public Command
-{
-public:
-  Syntax_error()
-  { }
-
-public:
-  int execute(st_net *net, ulong connection_id);
-};
-
-#endif /* INCLUDES_MYSQL_INSTANCE_MANAGER_COMMANDS_H */
diff -Nrup a/server-tools/instance-manager/exit_codes.h b/server-tools/instance-manager/exit_codes.h
--- a/server-tools/instance-manager/exit_codes.h	2006-12-23 22:33:28 +03:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,40 +0,0 @@
-#ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_EXIT_CODES_H
-#define INCLUDES_MYSQL_INSTANCE_MANAGER_EXIT_CODES_H
-
-/*
-   Copyright (C) 2006 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-/*
-  This file contains a list of exit codes, which are used when Instance
-  Manager is working in user-management mode.
-*/
-
-const int ERR_OK = 0;
-
-const int ERR_OUT_OF_MEMORY = 1;
-const int ERR_INVALID_USAGE = 2;
-const int ERR_INTERNAL_ERROR = 3;
-const int ERR_IO_ERROR = 4;
-const int ERR_PASSWORD_FILE_CORRUPTED = 5;
-const int ERR_PASSWORD_FILE_DOES_NOT_EXIST = 6;
-
-const int ERR_CAN_NOT_READ_USER_NAME = 10;
-const int ERR_CAN_NOT_READ_PASSWORD = 11;
-const int ERR_USER_ALREADY_EXISTS = 12;
-const int ERR_USER_NOT_FOUND = 13;
-
-#endif // INCLUDES_MYSQL_INSTANCE_MANAGER_EXIT_CODES_H
diff -Nrup a/server-tools/instance-manager/guardian.cc b/server-tools/instance-manager/guardian.cc
--- a/server-tools/instance-manager/guardian.cc	2007-07-27 17:38:59 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,496 +0,0 @@
-/* Copyright (C) 2004 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-
-#if defined(__GNUC__) && defined(USE_PRAGMA_IMPLEMENTATION)
-#pragma implementation
-#endif
-
-#include "guardian.h"
-#include <string.h>
-#include <sys/types.h>
-#include <signal.h>
-
-#include "instance.h"
-#include "instance_map.h"
-#include "log.h"
-#include "mysql_manager_error.h"
-#include "options.h"
-
-
-/*************************************************************************
- {{{ Constructor & destructor.
-*************************************************************************/
-
-/**
-  Guardian constructor.
-
-  SYNOPSIS
-    Guardian()
-    thread_registry_arg
-    instance_map_arg
-
-  DESCRIPTION
-    Nominal contructor intended for assigning references and initialize
-    trivial objects. Real initialization is made by init() method.
-*/
-
-Guardian::Guardian(Thread_registry *thread_registry_arg,
-                   Instance_map *instance_map_arg)
-  :shutdown_requested(FALSE),
-  stopped(FALSE),
-  thread_registry(thread_registry_arg),
-  instance_map(instance_map_arg)
-{
-  pthread_mutex_init(&LOCK_guardian, 0);
-  pthread_cond_init(&COND_guardian, 0);
-}
-
-
-Guardian::~Guardian()
-{
-  /*
-    NOTE: it's necessary to synchronize here, because Guiardian thread can be
-    still alive an hold the mutex (because it is detached and we have no
-    control over it).
-  */
-
-  lock();
-  unlock();
-
-  pthread_mutex_destroy(&LOCK_guardian);
-  pthread_cond_destroy(&COND_guardian);
-}
-
-/*************************************************************************
-  }}}
-*************************************************************************/
-
-
-/**
-  Send request to stop Guardian.
-
-  SYNOPSIS
-    request_shutdown()
-*/
-
-void Guardian::request_shutdown()
-{
-  stop_instances();
-
-  lock();
-  shutdown_requested= TRUE;
-  unlock();
-
-  ping();
-}
-
-
-/**
-  Process an instance.
-
-  SYNOPSIS
-    process_instance()
-    instance  a pointer to the instance for processing
-
-  MT-NOTE:
-    - the given instance must be locked before calling this operation;
-    - Guardian must be locked before calling this operation.
-*/
-
-void Guardian::process_instance(Instance *instance)
-{
-  int restart_retry= 100;
-  time_t current_time= time(NULL);
-
-  if (instance->get_state() == Instance::STOPPING)
-  {
-    /* This brach is executed during shutdown. */
-
-    /* This returns TRUE if and only if an instance was stopped for sure. */
-    if (instance->is_crashed())
-    {
-      log_info("Guardian: '%s' stopped.",
-               (const char *) instance->get_name()->str);
-
-      instance->set_state(Instance::STOPPED);
-    }
-    else if ((uint) (current_time - instance->last_checked) >=
-             instance->options.get_shutdown_delay())
-    {
-      log_info("Guardian: '%s' hasn't stopped within %d secs.",
-               (const char *) instance->get_name()->str,
-               (int) instance->options.get_shutdown_delay());
-
-      instance->kill_mysqld(SIGKILL);
-
-      log_info("Guardian: pretend that '%s' is killed.",
-               (const char *) instance->get_name()->str);
-
-      instance->set_state(Instance::STOPPED);
-    }
-    else
-    {
-      log_info("Guardian: waiting for '%s' to stop (%d secs left).",
-               (const char *) instance->get_name()->str,
-               (int) (instance->options.get_shutdown_delay() -
-                      current_time + instance->last_checked));
-    }
-
-    return;
-  }
-
-  if (instance->is_mysqld_running())
-  {
-    /* The instance can be contacted  on it's port */
-
-    /* If STARTING also check that pidfile has been created */
-    if (instance->get_state() == Instance::STARTING &&
-        instance->options.load_pid() == 0)
-    {
-      /* Pid file not created yet, don't go to STARTED state yet  */
-    }
-    else if (instance->get_state() != Instance::STARTED)
-    {
-      /* clear status fields */
-      log_info("Guardian: '%s' is running, set state to STARTED.",
-               (const char *) instance->options.instance_name.str);
-      instance->reset_stat();
-      instance->set_state(Instance::STARTED);
-    }
-  }
-  else
-  {
-    switch (instance->get_state()) {
-    case Instance::NOT_STARTED:
-      log_info("Guardian: starting '%s'...",
-               (const char *) instance->options.instance_name.str);
-
-      /* NOTE: set state to STARTING _before_ start() is called. */
-      instance->set_state(Instance::STARTING);
-      instance->last_checked= current_time;
-
-      instance->start_mysqld();
-
-      return;
-
-    case Instance::STARTED:     /* fallthrough */
-    case Instance::STARTING:    /* let the instance start or crash */
-      if (!instance->is_crashed())
-        return;
-
-      instance->crash_moment= current_time;
-      instance->last_checked= current_time;
-      instance->set_state(Instance::JUST_CRASHED);
-      /* fallthrough -- restart an instance immediately */
-
-    case Instance::JUST_CRASHED:
-      if (current_time - instance->crash_moment <= 2)
-      {
-        if (instance->is_crashed())
-        {
-          instance->start_mysqld();
-          log_info("Guardian: starting '%s'...",
-                   (const char *) instance->options.instance_name.str);
-        }
-      }
-      else
-        instance->set_state(Instance::CRASHED);
-
-      return;
-
-    case Instance::CRASHED:    /* just regular restarts */
-      if ((ulong) (current_time - instance->last_checked) <=
-          (ulong) Options::Main::monitoring_interval)
-        return;
-
-      if (instance->restart_counter < restart_retry)
-      {
-        if (instance->is_crashed())
-        {
-          instance->start_mysqld();
-          instance->last_checked= current_time;
-
-          log_info("Guardian: restarting '%s'...",
-                   (const char *) instance->options.instance_name.str);
-        }
-      }
-      else
-      {
-        log_info("Guardian: can not start '%s'. "
-                 "Abandoning attempts to (re)start it",
-                 (const char *) instance->options.instance_name.str);
-
-        instance->set_state(Instance::CRASHED_AND_ABANDONED);
-      }
-
-      return;
-
-    case Instance::CRASHED_AND_ABANDONED:
-      return; /* do nothing */
-
-    default:
-      DBUG_ASSERT(0);
-    }
-  }
-}
-
-
-/**
-  Main function of Guardian thread.
-
-  SYNOPSIS
-    run()
-
-  DESCRIPTION
-    Check for all guarded instances and restart them if needed.
-*/
-
-void Guardian::run()
-{
-  struct timespec timeout;
-
-  log_info("Guardian: started.");
-
-  thread_registry->register_thread(&thread_info);
-
-  /* Loop, until all instances were shut down at the end. */
-
-  while (true)
-  {
-    Instance_map::Iterator instances_it(instance_map);
-    Instance *instance;
-    bool all_instances_stopped= TRUE;
-
-    instance_map->lock();
-
-    while ((instance= instances_it.next()))
-    {
-      instance->lock();
-
-      if (!instance->is_guarded() ||
-          instance->get_state() == Instance::STOPPED)
-      {
-        instance->unlock();
-        continue;
-      }
-
-      process_instance(instance);
-
-      if (instance->get_state() != Instance::STOPPED)
-        all_instances_stopped= FALSE;
-
-      instance->unlock();
-    }
-
-    instance_map->unlock();
-
-    lock();
-
-    if (shutdown_requested && all_instances_stopped)
-    {
-      log_info("Guardian: all guarded mysqlds stopped.");
-
-      stopped= TRUE;
-      unlock();
-      break;
-    }
-
-    set_timespec(timeout, Options::Main::monitoring_interval);
-
-    thread_registry->cond_timedwait(&thread_info, &COND_guardian,
-                                    &LOCK_guardian, &timeout);
-    unlock();
-  }
-
-  log_info("Guardian: stopped.");
-
-  /* Now, when the Guardian is stopped we can stop the IM. */
-
-  thread_registry->unregister_thread(&thread_info);
-  thread_registry->request_shutdown();
-
-  log_info("Guardian: finished.");
-}
-
-
-/**
-  Return the value of stopped flag.
-*/
-
-bool Guardian::is_stopped()
-{
-  int var;
-
-  lock();
-  var= stopped;
-  unlock();
-
-  return var;
-}
-
-
-/**
-  Wake up Guardian thread.
-
-  MT-NOTE: though usually the mutex associated with condition variable should
-  be acquired before signalling the variable, here this is not needed.
-  Signalling under locked mutex is used to avoid lost signals. In the current
-  logic however locking mutex does not guarantee that the signal will not be
-  lost.
-*/
-
-void Guardian::ping()
-{
-  pthread_cond_signal(&COND_guardian);
-}
-
-
-/**
-  Prepare list of instances.
-
-  SYNOPSIS
-    init()
-
-  MT-NOTE: Instance Map must be locked before calling the operation.
-*/
-
-void Guardian::init()
-{
-  Instance *instance;
-  Instance_map::Iterator iterator(instance_map);
-
-  while ((instance= iterator.next()))
-  {
-    instance->lock();
-
-    instance->reset_stat();
-    instance->set_state(Instance::NOT_STARTED);
-
-    instance->unlock();
-  }
-}
-
-
-/**
-  An internal method which is called at shutdown to unregister instances and
-  attempt to stop them if requested.
-
-  SYNOPSIS
-    stop_instances()
-
-  DESCRIPTION
-    Loops through the guarded_instances list and prepares them for shutdown.
-    For each instance we issue a stop command and change the state
-    accordingly.
-
-  NOTE
-    Guardian object should be locked by the caller.
-
-*/
-
-void Guardian::stop_instances()
-{
-  static const int NUM_STOP_ATTEMPTS = 100;
-
-  Instance_map::Iterator instances_it(instance_map);
-  Instance *instance;
-
-  instance_map->lock();
-
-  while ((instance= instances_it.next()))
-  {
-    instance->lock();
-
-    if (!instance->is_guarded() ||
-        instance->get_state() == Instance::STOPPED)
-    {
-      instance->unlock();
-      continue;
-    }
-
-    /*
-      If instance is running or was running (and now probably hanging),
-      request stop.
-    */
-
-    if (instance->is_mysqld_running() ||
-        instance->get_state() == Instance::STARTED)
-    {
-      instance->set_state(Instance::STOPPING);
-      instance->last_checked= time(NULL);
-    }
-    else
-    {
-      /* Otherwise mark it as STOPPED. */
-      instance->set_state(Instance::STOPPED);
-    }
-
-    /* Request mysqld to stop. */
-
-    bool instance_stopped= FALSE;
-
-    for (int cur_attempt= 0; cur_attempt < NUM_STOP_ATTEMPTS; ++cur_attempt)
-    {
-      if (!instance->kill_mysqld(SIGTERM))
-      {
-        instance_stopped= TRUE;
-        break;
-      }
-
-      if (!instance->is_active())
-      {
-        instance_stopped= TRUE;
-        break;
-      }
-
-      /* Sleep for 0.3 sec and check again. */
-
-      my_sleep(300000);
-    }
-
-    /*
-      Abort if we failed to stop mysqld instance. That should not happen,
-      but if it happened, we don't know what to do and prefer to have clear
-      failure with coredump.
-    */
-
-    DBUG_ASSERT(instance_stopped);
-
-    instance->unlock();
-  }
-
-  instance_map->unlock();
-}
-
-
-/**
-  Lock Guardian.
-*/
-
-void Guardian::lock()
-{
-  pthread_mutex_lock(&LOCK_guardian);
-}
-
-
-/**
-  Unlock Guardian.
-*/
-
-void Guardian::unlock()
-{
-  pthread_mutex_unlock(&LOCK_guardian);
-}
diff -Nrup a/server-tools/instance-manager/guardian.h b/server-tools/instance-manager/guardian.h
--- a/server-tools/instance-manager/guardian.h	2007-01-03 00:18:05 +03:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,110 +0,0 @@
-#ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_GUARDIAN_H
-#define INCLUDES_MYSQL_INSTANCE_MANAGER_GUARDIAN_H
-/* Copyright (C) 2004 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-
-#include <my_global.h>
-#include <my_sys.h>
-#include <my_list.h>
-
-#include "thread_registry.h"
-
-#if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE)
-#pragma interface
-#endif
-
-class Instance;
-class Instance_map;
-class Thread_registry;
-
-/**
-  The guardian thread is responsible for monitoring and restarting of guarded
-  instances.
-*/
-
-class Guardian: public Thread
-{
-public:
-  Guardian(Thread_registry *thread_registry_arg,
-           Instance_map *instance_map_arg);
-  ~Guardian();
-
-  void init();
-
-public:
-  void request_shutdown();
-
-  bool is_stopped();
-
-  void lock();
-  void unlock();
-
-  void ping();
-
-protected:
-  virtual void run();
-
-private:
-  void stop_instances();
-
-  void process_instance(Instance *instance);
-
-private:
-  /*
-    LOCK_guardian protectes the members in this section:
-      - shutdown_requested;
-      - stopped;
-
-    Also, it is used for COND_guardian.
-  */
-  pthread_mutex_t LOCK_guardian;
-
-  /*
-    Guardian's main loop waits on this condition. So, it should be signalled
-    each time, when instance state has been changed and we want Guardian to
-    wake up.
-
-    TODO: Change this to having data-scoped conditions, i.e. conditions,
-    which indicate that some data has been changed.
-  */
-  pthread_cond_t COND_guardian;
-
-  /*
-    This variable is set to TRUE, when Manager thread is shutting down.
-    The flag is used by Guardian thread to understand that it's time to
-    finish.
-  */
-  bool shutdown_requested;
-
-  /*
-    This flag is set to TRUE on shutdown by Guardian thread, when all guarded
-    mysqlds are stopped.
-
-    The flag is used in the Manager thread to wait for Guardian to stop all
-    mysqlds.
-  */
-  bool stopped;
-
-  Thread_info thread_info;
-  Thread_registry *thread_registry;
-  Instance_map *instance_map;
-
-private:
-  Guardian(const Guardian &);
-  Guardian&operator =(const Guardian &);
-};
-
-#endif /* INCLUDES_MYSQL_INSTANCE_MANAGER_GUARDIAN_H */
diff -Nrup a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc
--- a/server-tools/instance-manager/instance.cc	2007-07-27 17:38:59 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,944 +0,0 @@
-/* Copyright (C) 2004 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-#if defined(__GNUC__) && defined(USE_PRAGMA_IMPLEMENTATION)
-#pragma implementation
-#endif
-
-#include <my_global.h>
-#include <mysql.h>
-
-#include <signal.h>
-#ifndef __WIN__
-#include <sys/wait.h>
-#endif
-
-#include "manager.h"
-#include "guardian.h"
-#include "instance.h"
-#include "log.h"
-#include "mysql_manager_error.h"
-#include "portability.h"
-#include "priv.h"
-#include "thread_registry.h"
-#include "instance_map.h"
-
-
-/*************************************************************************
-  {{{ Platform-specific functions.
-*************************************************************************/
-
-#ifndef __WIN__
-typedef pid_t My_process_info;
-#else
-typedef PROCESS_INFORMATION My_process_info;
-#endif
-
-/*
-  Wait for an instance
-
-  SYNOPSIS
-    wait_process()
-    pi                   Pointer to the process information structure
-                         (platform-dependent).
-
-  RETURN
-   0  -  Success
-   1  -  Error
-*/
-
-#ifndef __WIN__
-static int wait_process(My_process_info *pi)
-{
-  /*
-    Here we wait for the child created. This process differs for systems
-    running LinuxThreads and POSIX Threads compliant systems. This is because
-    according to POSIX we could wait() for a child in any thread of the
-    process. While LinuxThreads require that wait() is called by the thread,
-    which created the child.
-    On the other hand we could not expect mysqld to return the pid, we
-    got in from fork(), to wait4() fucntion when running on LinuxThreads.
-    This is because MySQL shutdown thread is not the one, which was created
-    by our fork() call.
-    So basically we have two options: whether the wait() call returns only in
-    the creator thread, but we cannot use waitpid() since we have no idea
-    which pid we should wait for (in fact it should be the pid of shutdown
-    thread, but we don't know this one). Or we could use waitpid(), but
-    couldn't use wait(), because it could return in any wait() in the program.
-  */
-
-  if (Manager::is_linux_threads())
-    wait(NULL);                               /* LinuxThreads were detected */
-  else
-    waitpid(*pi, NULL, 0);
-
-  return 0;
-}
-#else
-static int wait_process(My_process_info *pi)
-{
-  /* Wait until child process exits. */
-  WaitForSingleObject(pi->hProcess, INFINITE);
-
-  DWORD exitcode;
-  ::GetExitCodeProcess(pi->hProcess, &exitcode);
-
-  /* Close process and thread handles. */
-  CloseHandle(pi->hProcess);
-  CloseHandle(pi->hThread);
-
-  /*
-    GetExitCodeProces returns zero on failure. We should revert this value
-    to report an error.
-  */
-  return (!exitcode);
-}
-#endif
-
-/*
-  Launch an instance
-
-  SYNOPSIS
-    start_process()
-    instance_options     Pointer to the options of the instance to be
-                         launched.
-    pi                   Pointer to the process information structure
-                         (platform-dependent).
-
-  RETURN
-   FALSE - Success
-   TRUE  - Cannot create an instance
-*/
-
-#ifndef __WIN__
-static bool start_process(Instance_options *instance_options,
-                          My_process_info *pi)
-{
-#ifndef __QNX__
-  *pi= fork();
-#else
-  /*
-     On QNX one cannot use fork() in multithreaded environment and we
-     should use spawn() or one of it's siblings instead.
-     Here we use spawnv(), which  is a combination of fork() and execv()
-     in one call. It returns the pid of newly created process (>0) or -1
-  */
-  *pi= spawnv(P_NOWAIT, instance_options->mysqld_path, instance_options->argv);
-#endif
-
-  switch (*pi) {
-  case 0:                                       /* never happens on QNX */
-    execv(instance_options->mysqld_path.str, instance_options->argv);
-    /* exec never returns */
-    exit(1);
-  case -1:
-    log_error("Instance '%s': can not start mysqld: fork() failed.",
-              (const char *) instance_options->instance_name.str);
-    return TRUE;
-  }
-
-  return FALSE;
-}
-#else
-static bool start_process(Instance_options *instance_options,
-                          My_process_info *pi)
-{
-  STARTUPINFO si;
-
-  ZeroMemory(&si, sizeof(STARTUPINFO));
-  si.cb= sizeof(STARTUPINFO);
-  ZeroMemory(pi, sizeof(PROCESS_INFORMATION));
-
-  int cmdlen= 0;
-  for (int i= 0; instance_options->argv[i] != 0; i++)
-    cmdlen+= strlen(instance_options->argv[i]) + 3;
-  cmdlen++;   /* make room for the null */
-
-  char *cmdline= new char[cmdlen];
-  if (cmdline == NULL)
-    return TRUE;
-
-  cmdline[0]= 0;
-  for (int i= 0; instance_options->argv[i] != 0; i++)
-  {
-    strcat(cmdline, "\"");
-    strcat(cmdline, instance_options->argv[i]);
-    strcat(cmdline, "\" ");
-  }
-
-  /* Start the child process */
-  BOOL result=
-    CreateProcess(NULL,          /* Put it all in cmdline */
-                  cmdline,       /* Command line */
-                  NULL,          /* Process handle not inheritable */
-                  NULL,          /* Thread handle not inheritable */
-                  FALSE,         /* Set handle inheritance to FALSE */
-                  0,             /* No creation flags */
-                  NULL,          /* Use parent's environment block */
-                  NULL,          /* Use parent's starting directory */
-                  &si,           /* Pointer to STARTUPINFO structure */
-                  pi);           /* Pointer to PROCESS_INFORMATION structure */
-  delete cmdline;
-
-  return !result;
-}
-#endif
-
-#ifdef __WIN__
-
-BOOL SafeTerminateProcess(HANDLE hProcess, UINT uExitCode)
-{
-  DWORD dwTID, dwCode, dwErr= 0;
-  HANDLE hProcessDup= INVALID_HANDLE_VALUE;
-  HANDLE hRT= NULL;
-  HINSTANCE hKernel= GetModuleHandle("Kernel32");
-  BOOL bSuccess= FALSE;
-
-  BOOL bDup= DuplicateHandle(GetCurrentProcess(),
-                             hProcess, GetCurrentProcess(), &hProcessDup,
-                             PROCESS_ALL_ACCESS, FALSE, 0);
-
-  // Detect the special case where the process is
-  // already dead...
-  if (GetExitCodeProcess((bDup) ? hProcessDup : hProcess, &dwCode) &&
-      (dwCode == STILL_ACTIVE))
-  {
-    FARPROC pfnExitProc;
-
-    pfnExitProc= GetProcAddress(hKernel, "ExitProcess");
-
-    hRT= CreateRemoteThread((bDup) ? hProcessDup : hProcess, NULL, 0,
-                            (LPTHREAD_START_ROUTINE)pfnExitProc,
-                            (PVOID)uExitCode, 0, &dwTID);
-
-    if (hRT == NULL)
-      dwErr= GetLastError();
-  }
-  else
-    dwErr= ERROR_PROCESS_ABORTED;
-
-  if (hRT)
-  {
-    // Must wait process to terminate to
-    // guarantee that it has exited...
-    WaitForSingleObject((bDup) ? hProcessDup : hProcess, INFINITE);
-
-    CloseHandle(hRT);
-    bSuccess= TRUE;
-  }
-
-  if (bDup)
-    CloseHandle(hProcessDup);
-
-  if (!bSuccess)
-    SetLastError(dwErr);
-
-  return bSuccess;
-}
-
-int kill(pid_t pid, int signum)
-{
-  HANDLE processhandle= ::OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
-  if (signum == SIGTERM)
-    ::SafeTerminateProcess(processhandle, 0);
-  else
-    ::TerminateProcess(processhandle, -1);
-  return 0;
-}
-#endif
-
-/*************************************************************************
-  }}}
-*************************************************************************/
-
-
-/*************************************************************************
-  {{{ Static constants.
-*************************************************************************/
-
-const LEX_STRING
-Instance::DFLT_INSTANCE_NAME= { C_STRING_WITH_LEN("mysqld") };
-
-/*************************************************************************
-  }}}
-*************************************************************************/
-
-
-/*************************************************************************
-  {{{ Instance Monitor thread.
-*************************************************************************/
-
-/**
-  Proxy thread is a simple way to avoid all pitfalls of the threads
-  implementation in the OS (e.g. LinuxThreads). With such a thread we
-  don't have to process SIGCHLD, which is a tricky business if we want
-  to do it in a portable way.
-
-  Instance Monitor Thread forks a child process, execs mysqld and waits for
-  the child to die.
-
-  Instance Monitor assumes that the monitoring instance will not be dropped.
-  This is guaranteed by having flag monitoring_thread_active and
-  Instance::is_active() operation.
-*/
-
-class Instance_monitor: public Thread
-{
-public:
-  Instance_monitor(Instance *instance_arg) :instance(instance_arg) {}
-protected:
-  virtual void run();
-  void start_and_monitor_instance();
-private:
-  Instance *instance;
-};
-
-
-void Instance_monitor::run()
-{
-  start_and_monitor_instance();
-  delete this;
-}
-
-
-void Instance_monitor::start_and_monitor_instance()
-{
-  Thread_registry *thread_registry= Manager::get_thread_registry();
-  Guardian *guardian= Manager::get_guardian();
-
-  My_process_info mysqld_process_info;
-  Thread_info monitor_thread_info;
-
-  log_info("Instance '%s': Monitor: started.",
-           (const char *) instance->get_name()->str);
-
-  /*
-    For guarded instance register the thread in Thread_registry to wait for
-    the thread to stop on shutdown (nonguarded instances are not stopped on
-    shutdown, so the thread will no finish).
-  */
-
-  if (instance->is_guarded())
-  {
-    thread_registry->register_thread(&monitor_thread_info, FALSE);
-  }
-
-  /* Starting mysqld. */
-
-  log_info("Instance '%s': Monitor: starting mysqld...",
-           (const char *) instance->get_name()->str);
-
-  if (start_process(&instance->options, &mysqld_process_info))
-  {
-    instance->lock();
-    instance->monitoring_thread_active= FALSE;
-    instance->unlock();
-
-    return;
-  }
-
-  /* Waiting for mysqld to die. */
-
-  log_info("Instance '%s': Monitor: waiting for mysqld to stop...",
-           (const char *) instance->get_name()->str);
-
-  wait_process(&mysqld_process_info); /* Don't check for return value. */
-
-  log_info("Instance '%s': Monitor: mysqld stopped.",
-           (const char *) instance->get_name()->str);
-
-  /* Update instance status. */
-
-  instance->lock();
-
-  if (instance->is_guarded())
-    thread_registry->unregister_thread(&monitor_thread_info);
-
-  instance->crashed= TRUE;
-  instance->monitoring_thread_active= FALSE;
-
-  log_info("Instance '%s': Monitor: finished.",
-           (const char *) instance->get_name()->str);
-
-  instance->unlock();
-
-  /* Wake up guardian. */
-
-  guardian->ping();
-}
-
-/**************************************************************************
-  }}}
-**************************************************************************/
-
-
-/**************************************************************************
-  {{{ Static operations.
-**************************************************************************/
-
-/**
-  The operation is intended to check whether string is a well-formed
-  instance name or not.
-
-  SYNOPSIS
-    is_name_valid()
-    name  string to check
-
-  RETURN
-    TRUE    string is a valid instance name
-    FALSE   string is not a valid instance name
-
-  TODO: Move to Instance_name class: Instance_name::is_valid().
-*/
-
-bool Instance::is_name_valid(const LEX_STRING *name)
-{
-  const char *name_suffix= name->str + DFLT_INSTANCE_NAME.length;
-
-  if (strncmp(name->str, Instance::DFLT_INSTANCE_NAME.str,
-              Instance::DFLT_INSTANCE_NAME.length) != 0)
-    return FALSE;
-
-  return *name_suffix == 0 || my_isdigit(default_charset_info, *name_suffix);
-}
-
-
-/**
-  The operation is intended to check if the given instance name is
-  mysqld-compatible or not.
-
-  SYNOPSIS
-    is_mysqld_compatible_name()
-    name  name to check
-
-  RETURN
-    TRUE    name is mysqld-compatible
-    FALSE   otherwise
-
-  TODO: Move to Instance_name class: Instance_name::is_mysqld_compatible().
-*/
-
-bool Instance::is_mysqld_compatible_name(const LEX_STRING *name)
-{
-  return strcmp(name->str, DFLT_INSTANCE_NAME.str) == 0;
-}
-
-
-/**
-  Return client state name. Must not be used outside the class.
-  Use Instance::get_state_name() instead.
-*/
-
-const char * Instance::get_instance_state_name(enum_instance_state state)
-{
-  switch (state) {
-  case STOPPED:
-    return "offline";
-
-  case NOT_STARTED:
-    return "not started";
-
-  case STARTING:
-    return "starting";
-
-  case STARTED:
-    return "online";
-
-  case JUST_CRASHED:
-    return "failed";
-
-  case CRASHED:
-    return "crashed";
-
-  case CRASHED_AND_ABANDONED:
-    return "abandoned";
-
-  case STOPPING:
-    return "stopping";
-  }
-
-  return NULL; /* just to ignore compiler warning. */
-}
-
-/**************************************************************************
-  }}}
-**************************************************************************/
-
-
-/**************************************************************************
-  {{{ Initialization & deinitialization.
-**************************************************************************/
-
-Instance::Instance()
-  :monitoring_thread_active(FALSE),
-  crashed(FALSE),
-  configured(FALSE),
-  /* mysqld_compatible is initialized in init() */
-  state(NOT_STARTED),
-  restart_counter(0),
-  crash_moment(0),
-  last_checked(0)
-{
-  pthread_mutex_init(&LOCK_instance, 0);
-}
-
-
-Instance::~Instance()
-{
-  log_info("Instance '%s': destroying...", (const char *) get_name()->str);
-
-  pthread_mutex_destroy(&LOCK_instance);
-}
-
-
-/**
-  Initialize instance options.
-
-  SYNOPSIS
-    init()
-    name_arg      name of the instance
-
-  RETURN:
-    FALSE - ok
-    TRUE  - error
-*/
-
-bool Instance::init(const LEX_STRING *name_arg)
-{
-  mysqld_compatible= is_mysqld_compatible_name(name_arg);
-
-  return options.init(name_arg);
-}
-
-
-/**
-  @brief Complete instance options initialization.
-
-  @return Error status.
-    @retval FALSE ok
-    @retval TRUE error
-*/
-
-bool Instance::complete_initialization()
-{
-  configured= ! options.complete_initialization();
-  return !configured;
-}
-
-/**************************************************************************
-  }}}
-**************************************************************************/
-
-
-/**************************************************************************
-  {{{ Instance: public interface implementation.
-**************************************************************************/
-
-/**
-  Determine if there is some activity with the instance.
-
-  SYNOPSIS
-    is_active()
-
-  DESCRIPTION
-    An instance is active if one of the following conditions is true:
-      - Instance-monitoring thread is running;
-      - Instance is guarded and its state is other than STOPPED;
-      - Corresponding mysqld-server accepts connections.
-
-    MT-NOTE: instance must be locked before calling the operation.
-
-  RETURN
-    TRUE  - instance is active
-    FALSE - otherwise.
-*/
-
-bool Instance::is_active()
-{
-  if (monitoring_thread_active)
-    return TRUE;
-
-  if (is_guarded() && get_state() != STOPPED)
-    return TRUE;
-
-  return is_mysqld_running();
-}
-
-
-/**
-  Determine if mysqld is accepting connections.
-
-  SYNOPSIS
-    is_mysqld_running()
-
-  DESCRIPTION
-    Try to connect to mysqld with fake login/password to check whether it is
-    accepting connections or not.
-
-    MT-NOTE: instance must be locked before calling the operation.
-
-  RETURN
-    TRUE  - mysqld is alive and accept connections
-    FALSE - otherwise.
-*/
-
-bool Instance::is_mysqld_running()
-{
-  MYSQL mysql;
-  uint port= options.get_mysqld_port(); /* 0 if not specified. */
-  const char *socket= NULL;
-  static const char *password= "check_connection";
-  static const char *username= "MySQL_Instance_Manager";
-  static const char *access_denied_message= "Access denied for user";
-  bool return_val;
-
-  if (options.mysqld_socket)
-    socket= options.mysqld_socket;
-
-  /* no port was specified => instance falled back to default value */
-  if (!port && !options.mysqld_socket)
-    port= SERVER_DEFAULT_PORT;
-
-  mysql_init(&mysql);
-  /* try to connect to a server with a fake username/password pair */
-  if (mysql_real_connect(&mysql, LOCAL_HOST, username,
-                         password,
-                         NullS, port,
-                         socket, 0))
-  {
-    /*
-      We have successfully connected to the server using fake
-      username/password. Write a warning to the logfile.
-    */
-    log_error("Instance '%s': was able to log into mysqld.",
-              (const char *) get_name()->str);
-    return_val= TRUE;                           /* server is alive */
-  }
-  else
-    return_val= test(!strncmp(access_denied_message, mysql_error(&mysql),
-                              sizeof(access_denied_message) - 1));
-
-  mysql_close(&mysql);
-
-  return return_val;
-}
-
-
-/**
-  @brief Start mysqld.
-
-  Reset flags and start Instance Monitor thread, which will start mysqld.
-
-  @note Instance must be locked before calling the operation.
-
-  @return Error status code
-    @retval FALSE Ok
-    @retval TRUE Could not start instance
-*/
-
-bool Instance::start_mysqld()
-{
-  Instance_monitor *instance_monitor;
-
-  if (!configured)
-    return TRUE;
-
-  /*
-    Prepare instance to start Instance Monitor thread.
-
-    NOTE: It's important to set these actions here in order to avoid
-    race conditions -- these actions must be done under acquired lock on
-    Instance.
-  */
-
-  crashed= FALSE;
-  monitoring_thread_active= TRUE;
-
-  remove_pid();
-
-  /* Create and start the Instance Monitor thread. */
-
-  instance_monitor= new Instance_monitor(this);
-
-  if (instance_monitor == NULL || instance_monitor->start(Thread::DETACHED))
-  {
-    delete instance_monitor;
-    monitoring_thread_active= FALSE;
-
-    log_error("Instance '%s': can not create instance monitor thread.",
-              (const char *) get_name()->str);
-
-    return TRUE;
-  }
-
-  ++restart_counter;
-
-  /* The Instance Monitor thread will delete itself when it's finished. */
-
-  return FALSE;
-}
-
-
-/**
-  Stop mysqld.
-
-  SYNOPSIS
-    stop_mysqld()
-
-  DESCRIPTION
-    Try to stop mysqld gracefully. Otherwise kill it with SIGKILL.
-
-    MT-NOTE: instance must be locked before calling the operation.
-
-  RETURN
-    FALSE - ok
-    TRUE  - could not stop the instance
-*/
-
-bool Instance::stop_mysqld()
-{
-  log_info("Instance '%s': stopping mysqld...",
-           (const char *) get_name()->str);
-
-  kill_mysqld(SIGTERM);
-
-  if (!wait_for_stop())
-  {
-    log_info("Instance '%s': mysqld stopped gracefully.",
-             (const char *) get_name()->str);
-    return FALSE;
-  }
-
-  log_info("Instance '%s': mysqld failed to stop gracefully within %d seconds.",
-           (const char *) get_name()->str,
-           (int) options.get_shutdown_delay());
-
-  log_info("Instance'%s': killing mysqld...",
-           (const char *) get_name()->str);
-
-  kill_mysqld(SIGKILL);
-
-  if (!wait_for_stop())
-  {
-    log_info("Instance '%s': mysqld has been killed.",
-             (const char *) get_name()->str);
-    return FALSE;
-  }
-
-  log_info("Instance '%s': can not kill mysqld within %d seconds.",
-           (const char *) get_name()->str,
-           (int) options.get_shutdown_delay());
-
-  return TRUE;
-}
-
-
-/**
-  Send signal to mysqld.
-
-  SYNOPSIS
-    kill_mysqld()
-
-  DESCRIPTION
-    Load pid from the pid file and send the given signal to that process.
-    If the signal is SIGKILL, remove the pid file after sending the signal.
-
-    MT-NOTE: instance must be locked before calling the operation.
-
-  TODO
-    This too low-level and OS-specific operation for public interface.
-    Also, it has some implicit behaviour for SIGKILL signal. Probably, we
-    should have the following public operations instead:
-      - start_mysqld() -- as is;
-      - stop_mysqld -- request mysqld to shutdown gracefully (send SIGTERM);
-        don't wait for complete shutdown;
-      - wait_for_stop() (or join_mysqld()) -- wait for mysqld to stop within
-        time interval;
-      - kill_mysqld() -- request to terminate mysqld; don't wait for
-        completion.
-    These operations should also be used in Guardian to manage instances.
-*/
-
-bool Instance::kill_mysqld(int signum)
-{
-  pid_t mysqld_pid= options.load_pid();
-
-  if (mysqld_pid == 0)
-  {
-    log_info("Instance '%s': no pid file to send a signal (%d).",
-             (const char *) get_name()->str,
-             (int) signum);
-    return TRUE;
-  }
-
-  log_info("Instance '%s': sending %d to %d...",
-           (const char *) get_name()->str,
-           (int) signum,
-           (int) mysqld_pid);
-
-  if (kill(mysqld_pid, signum))
-  {
-    log_info("Instance '%s': kill() failed.",
-             (const char *) get_name()->str);
-    return TRUE;
-  }
-
-  /* Kill suceeded */
-  if (signum == SIGKILL)      /* really killed instance with SIGKILL */
-  {
-    log_error("Instance '%s': killed.",
-              (const char *) options.instance_name.str);
-
-    /* After sucessful hard kill the pidfile need to be removed */
-    options.unlink_pidfile();
-  }
-
-  return FALSE;
-}
-
-
-/**
-  Lock instance.
-*/
-
-void Instance::lock()
-{
-  pthread_mutex_lock(&LOCK_instance);
-}
-
-
-/**
-  Unlock instance.
-*/
-
-void Instance::unlock()
-{
-  pthread_mutex_unlock(&LOCK_instance);
-}
-
-
-/**
-  Return instance state name.
-
-  SYNOPSIS
-    get_state_name()
-
-  DESCRIPTION
-    The operation returns user-friendly state name. The operation can be
-    used both for guarded and non-guarded instances.
-
-    MT-NOTE: instance must be locked before calling the operation.
-
-  TODO: Replace with the static get_state_name(state_code) function.
-*/
-
-const char *Instance::get_state_name()
-{
-  if (!is_configured())
-    return "misconfigured";
-
-  if (is_guarded())
-  {
-    /* The instance is managed by Guardian: we can report precise state. */
-
-    return get_instance_state_name(get_state());
-  }
-
-  /* The instance is not managed by Guardian: we can report status only.  */
-
-  return is_active() ? "online" : "offline";
-}
-
-
-/**
-  Reset statistics.
-
-  SYNOPSIS
-    reset_stat()
-
-  DESCRIPTION
-    The operation resets statistics used for guarding the instance.
-
-    MT-NOTE: instance must be locked before calling the operation.
-
-  TODO: Make private.
-*/
-
-void Instance::reset_stat()
-{
-  restart_counter= 0;
-  crash_moment= 0;
-  last_checked= 0;
-}
-
-/**************************************************************************
-  }}}
-**************************************************************************/
-
-
-/**************************************************************************
-  {{{ Instance: implementation of private operations.
-**************************************************************************/
-
-/**
-  Remove pid file.
-*/
-
-void Instance::remove_pid()
-{
-  int mysqld_pid= options.load_pid();
-
-  if (mysqld_pid == 0)
-    return;
-
-  if (options.unlink_pidfile())
-  {
-    log_error("Instance '%s': can not unlink pid file.",
-              (const char *) options.instance_name.str);
-  }
-}
-
-
-/**
-  Wait for mysqld to stop within shutdown interval.
-*/
-
-bool Instance::wait_for_stop()
-{
-  int start_time= (int) time(NULL);
-  int finish_time= start_time + options.get_shutdown_delay();
-
-  log_info("Instance '%s': waiting for mysqld to stop "
-           "(timeout: %d seconds)...",
-           (const char *) get_name()->str,
-           (int) options.get_shutdown_delay());
-
-  while (true)
-  {
-    if (options.load_pid() == 0 && !is_mysqld_running())
-      return FALSE;
-
-    if (time(NULL) >= finish_time)
-      return TRUE;
-
-    /* Sleep for 0.3 sec and check again. */
-
-    my_sleep(300000);
-  }
-}
-
-/**************************************************************************
-  }}}
-**************************************************************************/
diff -Nrup a/server-tools/instance-manager/instance.h b/server-tools/instance-manager/instance.h
--- a/server-tools/instance-manager/instance.h	2007-07-27 17:38:59 +04:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,273 +0,0 @@
-#ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_INSTANCE_H
-#define INCLUDES_MYSQL_INSTANCE_MANAGER_INSTANCE_H
-/* Copyright (C) 2004 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-#include <my_global.h>
-#include <m_string.h>
-
-#include "instance_options.h"
-#include "priv.h"
-
-#if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE)
-#pragma interface
-#endif
-
-class Instance_map;
-class Thread_registry;
-
-
-/**
-  Instance_name -- the class represents instance name -- a string of length
-  less than MAX_INSTANCE_NAME_SIZE.
-
-  Generally, this is just a string with self-memory-management and should be
-  eliminated in the future.
-*/
-
-class Instance_name
-{
-public:
-  Instance_name(const LEX_STRING *name);
-
-public:
-  inline const LEX_STRING *get_str() const
-  {
-    return &str;
-  }
-
-  inline const char *get_c_str() const
-  {
-    return str.str;
-  }
-
-  inline uint get_length() const
-  {
-    return str.length;
-  }
-
-private:
-  LEX_STRING str;
-  char str_buffer[MAX_INSTANCE_NAME_SIZE];
-};
-
-
-class Instance