Below is the list of changes that have just been committed into a local
5.1 repository of alik. When alik 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
1.2389 06/05/18 15:24:35 anozdrin@stripped +78 -0
This is an implementation of two WL items:
- WL#3158: IM: Instance configuration extensions;
- WL#3159: IM: --bootstrap and --start-default-instance modes
The following new statements have been added:
- CREATE INSTANCE;
- DROP INSTANCE;
The behaviour of the following statements have been changed:
- SET;
- UNSET;
- FLUSH INSTANCES;
- SHOW INSTANCES;
- SHOW INSTANCE OPTIONS;
server-tools/instance-manager/user_management_commands.h
1.1 06/05/18 15:24:32 anozdrin@stripped +167 -0
User-management command declarations.
server-tools/instance-manager/user_management_commands.h
1.0 06/05/18 15:24:32 anozdrin@stripped +0 -0
BitKeeper file
/mnt/raid/MySQL/devel/5.1-wl3158/server-tools/instance-manager/user_management_commands.h
server-tools/instance-manager/user_management_commands.cc
1.1 06/05/18 15:24:31 anozdrin@stripped +408 -0
User-management commands implementation.
server-tools/instance-manager/exit_codes.h
1.1 06/05/18 15:24:31 anozdrin@stripped +41 -0
New file for defining exit codes for user-management mode.
mysql-test/t/im_utils-im.opt
1.1 06/05/18 15:24:31 anozdrin@stripped +1 -0
Set minimal monitoring interval for Instance Manager to speed up testing.
mysql-test/t/im_options.imtest
1.1 06/05/18 15:24:31 anozdrin@stripped +268 -0
Join im_options_set and im_options_unset and add new tests.
mysql-test/t/im_life_cycle-im.opt
1.1 06/05/18 15:24:31 anozdrin@stripped +1 -0
Set minimal monitoring interval for Instance Manager to speed up testing.
server-tools/instance-manager/user_management_commands.cc
1.0 06/05/18 15:24:31 anozdrin@stripped +0 -0
BitKeeper file
/mnt/raid/MySQL/devel/5.1-wl3158/server-tools/instance-manager/user_management_commands.cc
server-tools/instance-manager/exit_codes.h
1.0 06/05/18 15:24:31 anozdrin@stripped +0 -0
BitKeeper file
/mnt/raid/MySQL/devel/5.1-wl3158/server-tools/instance-manager/exit_codes.h
mysql-test/t/im_utils-im.opt
1.0 06/05/18 15:24:31 anozdrin@stripped +0 -0
BitKeeper file /mnt/raid/MySQL/devel/5.1-wl3158/mysql-test/t/im_utils-im.opt
mysql-test/t/im_options.imtest
1.0 06/05/18 15:24:31 anozdrin@stripped +0 -0
BitKeeper file /mnt/raid/MySQL/devel/5.1-wl3158/mysql-test/t/im_options.imtest
mysql-test/t/im_life_cycle-im.opt
1.0 06/05/18 15:24:31 anozdrin@stripped +0 -0
BitKeeper file /mnt/raid/MySQL/devel/5.1-wl3158/mysql-test/t/im_life_cycle-im.opt
mysql-test/t/im_instance_conf.imtest
1.1 06/05/18 15:24:30 anozdrin@stripped +228 -0
Added a new test case for checking instance-management.
mysql-test/t/im_instance_conf-im.opt
1.1 06/05/18 15:24:30 anozdrin@stripped +1 -0
Set minimal monitoring interval for Instance Manager to speed up testing.
mysql-test/t/im_cmd_line.imtest
1.1 06/05/18 15:24:30 anozdrin@stripped +68 -0
IM command-line options test.
mysql-test/r/im_options.result
1.1 06/05/18 15:24:30 anozdrin@stripped +150 -0
Added result file.
mysql-test/r/im_instance_conf.result
1.1 06/05/18 15:24:30 anozdrin@stripped +196 -0
Added result file.
mysql-test/t/im_instance_conf.imtest
1.0 06/05/18 15:24:30 anozdrin@stripped +0 -0
BitKeeper file /mnt/raid/MySQL/devel/5.1-wl3158/mysql-test/t/im_instance_conf.imtest
mysql-test/t/im_instance_conf-im.opt
1.0 06/05/18 15:24:30 anozdrin@stripped +0 -0
BitKeeper file /mnt/raid/MySQL/devel/5.1-wl3158/mysql-test/t/im_instance_conf-im.opt
mysql-test/t/im_cmd_line.imtest
1.0 06/05/18 15:24:30 anozdrin@stripped +0 -0
BitKeeper file /mnt/raid/MySQL/devel/5.1-wl3158/mysql-test/t/im_cmd_line.imtest
mysql-test/r/im_options.result
1.0 06/05/18 15:24:30 anozdrin@stripped +0 -0
BitKeeper file /mnt/raid/MySQL/devel/5.1-wl3158/mysql-test/r/im_options.result
mysql-test/r/im_instance_conf.result
1.0 06/05/18 15:24:30 anozdrin@stripped +0 -0
BitKeeper file /mnt/raid/MySQL/devel/5.1-wl3158/mysql-test/r/im_instance_conf.result
mysql-test/r/im_cmd_line.result
1.1 06/05/18 15:24:29 anozdrin@stripped +40 -0
IM command-line options test result file.
support-files/mysql.server.sh
1.50 06/05/18 15:24:29 anozdrin@stripped +4 -1
Instruct Instance Manager to work in mysqld-safe compatible mode
for backward compatibility.
sql/structs.h
1.59 06/05/18 15:24:29 anozdrin@stripped +0 -16
Removed LEX_STRING_WITH_INIT.
sql/sql_trigger.cc
1.55 06/05/18 15:24:29 anozdrin@stripped +2 -2
Replaces LEX_STRING_WITH_INIT by LEX_STRING + STRING_WITH_LEN.
sql/sql_string.h
1.61 06/05/18 15:24:29 anozdrin@stripped +0 -2
Moved STRING_WITH_LEN() macro out from sql (to m_string.h).
sql/spatial.h
1.20 06/05/18 15:24:29 anozdrin@stripped +1 -1
Removed LEX_STRING_WITH_INIT.
sql/spatial.cc
1.28 06/05/18 15:24:29 anozdrin@stripped +4 -1
Removed LEX_STRING_WITH_INIT.
sql/sp_head.cc
1.218 06/05/18 15:24:29 anozdrin@stripped +2 -2
Replaced LEX_STRING_WITH_INIT by LEX_STRING + struct initialization.
sql/sp.cc
1.109 06/05/18 15:24:29 anozdrin@stripped +4 -6
Replaced LEX_STRING_WITH_INIT by LEX_STRING + struct initialization.
server-tools/instance-manager/user_map.h
1.6 06/05/18 15:24:29 anozdrin@stripped +60 -3
Added support for managing password database.
server-tools/instance-manager/user_map.cc
1.16 06/05/18 15:24:29 anozdrin@stripped +268 -56
Added support for managing password database.
server-tools/instance-manager/thread_registry.cc
1.11 06/05/18 15:24:29 anozdrin@stripped +6 -5
Polishing: use TRUE/FALSE instead of true/false.
server-tools/instance-manager/protocol.h
1.7 06/05/18 15:24:29 anozdrin@stripped +0 -5
Replaced NAME_WITH_LENGTH by LEX_STRING.
server-tools/instance-manager/protocol.cc
1.14 06/05/18 15:24:29 anozdrin@stripped +4 -4
Replaced NAME_WITH_LENGTH by LEX_STRING.
server-tools/instance-manager/priv.h
1.11 06/05/18 15:24:29 anozdrin@stripped +24 -6
Added some global constants.
server-tools/instance-manager/priv.cc
1.11 06/05/18 15:24:29 anozdrin@stripped +3 -5
Updated version.
server-tools/instance-manager/portability.h
1.9 06/05/18 15:24:29 anozdrin@stripped +14 -0
1. Added constants for Windows.
2. Moved system-dependent defines from instance_options.cc.
server-tools/instance-manager/parse_output.h
1.6 06/05/18 15:24:29 anozdrin@stripped +2 -0
Sorted out header files.
server-tools/instance-manager/parse_output.cc
1.20 06/05/18 15:24:29 anozdrin@stripped +5 -3
Sorted out header files.
server-tools/instance-manager/parse.h
1.7 06/05/18 15:24:29 anozdrin@stripped +154 -5
1. Added support of new statements:
- CREATE INSTANCE;
- DROP INSTANCE.
2. Modified SET/UNSET.
server-tools/instance-manager/parse.cc
1.14 06/05/18 15:24:29 anozdrin@stripped +265 -86
1. Added support of new statements:
- CREATE INSTANCE;
- DROP INSTANCE.
2. Modified SET/UNSET.
server-tools/instance-manager/options.h
1.16 06/05/18 15:24:29 anozdrin@stripped +65 -28
Added support for user-management command-line options.
server-tools/instance-manager/options.cc
1.33 06/05/18 15:24:29 anozdrin@stripped +273 -125
Added support for user-management command-line options.
server-tools/instance-manager/mysqlmanager.cc
1.17 06/05/18 15:24:29 anozdrin@stripped +50 -27
1. Use error code from Options::load();
2. Eliminate type-casting warning on Windows.
server-tools/instance-manager/mysql_manager_error.h
1.4 06/05/18 15:24:29 anozdrin@stripped +8 -0
Added new errors.
server-tools/instance-manager/mysql_connection.cc
1.16 06/05/18 15:24:29 anozdrin@stripped +24 -22
1. Move a constant to common place.
2. Polishing.
server-tools/instance-manager/messages.cc
1.6 06/05/18 15:24:29 anozdrin@stripped +20 -4
Added messages for new errors.
server-tools/instance-manager/manager.h
1.5 06/05/18 15:24:29 anozdrin@stripped +1 -3
Added a common for IM operation to work with configuration file.
server-tools/instance-manager/manager.cc
1.32 06/05/18 15:24:29 anozdrin@stripped +93 -36
Added a common for IM operation to work with configuration file.
server-tools/instance-manager/log.cc
1.9 06/05/18 15:24:29 anozdrin@stripped +5 -5
Polishing: use TRUE/FALSE instead of true/false.
server-tools/instance-manager/listener.h
1.7 06/05/18 15:24:29 anozdrin@stripped +0 -4
Remove reference to the instance of Options;
server-tools/instance-manager/listener.cc
1.26 06/05/18 15:24:29 anozdrin@stripped +14 -11
1. Remove reference to the instance of Options;
2. Use new Options naming scheme.
server-tools/instance-manager/instance_options.h
1.20 06/05/18 15:24:29 anozdrin@stripped +36 -22
Changed Instance_options so that it will be possible to manage
options on the fly.
server-tools/instance-manager/instance_options.cc
1.33 06/05/18 15:24:29 anozdrin@stripped +188 -131
Changed Instance_options so that it will be possible to manage
options on the fly.
server-tools/instance-manager/instance_map.h
1.19 06/05/18 15:24:29 anozdrin@stripped +54 -8
Added operations to manage instances.
server-tools/instance-manager/instance_map.cc
1.27 06/05/18 15:24:29 anozdrin@stripped +358 -77
1. Used the operation to check validity of instance name;
2. Added operations to manage instances.
server-tools/instance-manager/instance.h
1.16 06/05/18 15:24:29 anozdrin@stripped +114 -4
1. Provided an operation to check validity of instance name.
2. Added an attribute to distiguish mysqld-instances,
whose configuration should be kept backward-compatible.
server-tools/instance-manager/instance.cc
1.33 06/05/18 15:24:29 anozdrin@stripped +87 -35
1. Provided an operation to check validity of instance name.
2. Added an attribute to distiguish mysqld-instances,
whose configuration should be kept backward-compatible.
mysql-test/r/im_cmd_line.result
1.0 06/05/18 15:24:29 anozdrin@stripped +0 -0
BitKeeper file /mnt/raid/MySQL/devel/5.1-wl3158/mysql-test/r/im_cmd_line.result
server-tools/instance-manager/guardian.h
1.13 06/05/18 15:24:28 anozdrin@stripped +30 -4
Added operations to retrieve state of managed instances.
server-tools/instance-manager/guardian.cc
1.22 06/05/18 15:24:28 anozdrin@stripped +101 -32
Added operations to retrieve state of managed instances.
server-tools/instance-manager/commands.h
1.10 06/05/18 15:24:28 anozdrin@stripped +231 -72
1. Added support for CREATE INSTANCE, DROP INSTANCE statements;
2. Added "deprecated" column in output of SHOW INSTANCE OPTIONS;
3. Modified the behaviour of SET/UNSET, FLUSH INSTANCES statements;
server-tools/instance-manager/commands.cc
1.34 06/05/18 15:24:28 anozdrin@stripped +1366 -483
1. Added support for CREATE INSTANCE, DROP INSTANCE statements;
2. Added "deprecated" column in output of SHOW INSTANCE OPTIONS;
3. Modified the behaviour of SET/UNSET, FLUSH INSTANCES statements;
server-tools/instance-manager/command.h
1.6 06/05/18 15:24:28 anozdrin@stripped +15 -3
Polishing: provide a comment for the main operation of "Command" class.
server-tools/instance-manager/WindowsService.h
1.6 06/05/18 15:24:28 anozdrin@stripped +18 -0
Polishing: added copyright.
server-tools/instance-manager/WindowsService.cpp
1.6 06/05/18 15:24:28 anozdrin@stripped +18 -15
Polishing: according to The Coding Style, TRUE/FALSE must be
used instead of true/false.
server-tools/instance-manager/Makefile.am
1.35 06/05/18 15:24:28 anozdrin@stripped +7 -1
Added new files.
server-tools/instance-manager/IMService.h
1.4 06/05/18 15:24:28 anozdrin@stripped +20 -0
Polishing: added copyright.
server-tools/instance-manager/IMService.cpp
1.8 06/05/18 15:24:28 anozdrin@stripped +19 -6
Polishing: be more verbose.
mysys/default_modify.c
1.12 06/05/18 15:24:28 anozdrin@stripped +43 -15
Added REMOVE_SECTION functionality.
mysys/default.c
1.81 06/05/18 15:24:28 anozdrin@stripped +9 -1
Pass the name of the section to the handler function as well.
mysql-test/t/im_utils.imtest
1.2 06/05/18 15:24:28 anozdrin@stripped +6 -2
Get Instance Manager and managed mysqld-instances enough time to start.
mysql-test/t/im_life_cycle.imtest
1.6 06/05/18 15:24:28 anozdrin@stripped +67 -28
1. Polishing;
2. Fixed a test error in 1.1.2.
mysql-test/t/im_daemon_life_cycle.imtest
1.2 06/05/18 15:24:28 anozdrin@stripped +3 -0
Get Instance Manager and managed mysqld-instances enough time to start.
mysql-test/t/im_daemon_life_cycle-im.opt
1.3 06/05/18 15:24:28 anozdrin@stripped +1 -0
Set minimal monitoring interval for Instance Manager to speed up testing.
mysql-test/r/im_utils.result
1.4 06/05/18 15:24:28 anozdrin@stripped +2 -4
Updated the result file.
mysql-test/r/im_life_cycle.result
1.6 06/05/18 15:24:28 anozdrin@stripped +48 -24
1. Column name has been changed in SHOW INSTANCES.
2. Removed redundant SHOW INSTANCE STATUS statements.
mysql-test/r/im_daemon_life_cycle.result
1.2 06/05/18 15:24:28 anozdrin@stripped +1 -1
Column name has been changed in SHOW INSTANCES.
mysql-test/mysql-test-run.pl
1.113 06/05/18 15:24:28 anozdrin@stripped +3 -0
Added environment variables to be used from tests.
libmysql/get_password.c
1.16 06/05/18 15:24:28 anozdrin@stripped +2 -2
Change prototype to avoid casting when using C-strings (char *).
include/mysql_com.h
1.106 06/05/18 15:24:28 anozdrin@stripped +1 -7
Removed duplicated declarations. my_sys.h should be used instead.
include/my_sys.h
1.192 06/05/18 15:24:28 anozdrin@stripped +4 -0
Added constants for modify_defaults_file().
include/m_string.h
1.42 06/05/18 15:24:28 anozdrin@stripped +12 -0
Moved LEX_STRING to global header from sql/ to be accessible
from all components (IM for one).
client/get_password.c
1.11 06/05/18 15:24:28 anozdrin@stripped +2 -2
Change prototype to avoid casting when using C-strings (char *).
BitKeeper/deleted/.del-im_options_unset.result~20a4790cd3c70a4f
1.2 06/05/04 13:49:09 anozdrin@stripped +0 -0
Delete: mysql-test/r/im_options_unset.result
BitKeeper/deleted/.del-im_options_unset.imtest~768eb186b51d0048
1.3 06/05/04 13:49:09 anozdrin@stripped +0 -0
Delete: mysql-test/t/im_options_unset.imtest
BitKeeper/deleted/.del-im_options_set.result~59278f56be61d921
1.2 06/05/04 13:49:09 anozdrin@stripped +0 -0
Delete: mysql-test/r/im_options_set.result
BitKeeper/deleted/.del-im_options_set.imtest~b53d9d60e5684833
1.3 06/05/04 13:49:09 anozdrin@stripped +0 -0
Delete: mysql-test/t/im_options_set.imtest
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: anozdrin
# Host: station.home
# Root: /mnt/raid/MySQL/devel/5.1-wl3158
--- 1.10/client/get_password.c 2003-08-07 22:17:14 +04:00
+++ 1.11/client/get_password.c 2006-05-18 15:24:28 +04:00
@@ -64,7 +64,7 @@
/* were just going to fake it here and get input from
the keyboard */
-char *get_tty_password(char *opt_message)
+char *get_tty_password(const char *opt_message)
{
char to[80];
char *pos=to,*end=to+sizeof(to)-1;
@@ -150,7 +150,7 @@
#endif /* ! HAVE_GETPASS */
-char *get_tty_password(char *opt_message)
+char *get_tty_password(const char *opt_message)
{
#ifdef HAVE_GETPASS
char *passbuff;
--- 1.41/include/m_string.h 2006-04-18 00:05:13 +04:00
+++ 1.42/include/m_string.h 2006-05-18 15:24:28 +04:00
@@ -246,4 +246,16 @@
#if defined(__cplusplus)
}
#endif
+
+/* LEX_STRING */
+
+typedef struct LEX_STRING
+{
+ char *str;
+ uint length;
+};
+
+#define STRING_WITH_LEN(X) (X), ((uint) (sizeof(X) - 1))
+#define C_STRING_WITH_SIZE(X) ((char *) (X)), ((uint) (sizeof(X) - 1))
+
#endif
--- 1.191/include/my_sys.h 2006-05-02 21:51:36 +04:00
+++ 1.192/include/my_sys.h 2006-05-18 15:24:28 +04:00
@@ -76,6 +76,10 @@
#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
#define MY_GIVE_INFO 2 /* Give time info about process*/
+#define MY_REMOVE_NONE 0 /* Params for modify_defaults_file */
+#define MY_REMOVE_OPTION 1
+#define MY_REMOVE_SECTION 2
+
#define ME_HIGHBYTE 8 /* Shift for colours */
#define ME_NOCUR 1 /* Don't use curses message */
#define ME_OLDWIN 2 /* Use old window */
--- 1.105/include/mysql_com.h 2006-01-13 19:04:32 +03:00
+++ 1.106/include/mysql_com.h 2006-05-18 15:24:28 +04:00
@@ -423,17 +423,11 @@
/* end of password.c */
-char *get_tty_password(char *opt_message);
+char *get_tty_password(const char *opt_message);
const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
/* Some other useful functions */
-my_bool my_init(void);
-extern int modify_defaults_file(const char *file_location, const char *option,
- const char *option_value,
- const char *section_name, int remove_option);
-int load_defaults(const char *conf_file, const char **groups,
- int *argc, char ***argv);
my_bool my_thread_init(void);
void my_thread_end(void);
--- 1.15/libmysql/get_password.c 2006-04-16 05:17:24 +04:00
+++ 1.16/libmysql/get_password.c 2006-05-18 15:24:28 +04:00
@@ -75,7 +75,7 @@
#define _cputs(A) putstring(A)
#endif
-char *get_tty_password(char *opt_message)
+char *get_tty_password(const char *opt_message)
{
char to[80];
char *pos=to,*end=to+sizeof(to)-1;
@@ -159,7 +159,7 @@
#endif /* ! HAVE_GETPASS */
-char *get_tty_password(char *opt_message)
+char *get_tty_password(const char *opt_message)
{
#ifdef HAVE_GETPASS
char *passbuff;
--- 1.80/mysys/default.c 2006-04-15 19:48:54 +04:00
+++ 1.81/mysys/default.c 2006-05-18 15:24:28 +04:00
@@ -244,7 +244,8 @@
handle_option_ctx structure.
group_name The name of the group the option belongs to.
option The very option to be processed. It is already
- prepared to be used in argv (has -- prefix)
+ prepared to be used in argv (has -- prefix). If it
+ is NULL, we are handling a new group (section).
DESCRIPTION
This handler checks whether a group is one of the listed and adds an option
@@ -263,6 +264,9 @@
char *tmp;
struct handle_option_ctx *ctx= (struct handle_option_ctx *) in_ctx;
+ if (!option)
+ return 0;
+
if (find_type((char *)group_name, ctx->group, 3))
{
if (!(tmp= alloc_root(ctx->alloc, (uint) strlen(option) + 1)))
@@ -719,6 +723,10 @@
end[0]=0;
strnmov(curr_gr, ptr, min((uint) (end-ptr)+1, 4096));
+
+ /* signal that a new group is found */
+ opt_handler(handler_ctx, curr_gr, NULL);
+
continue;
}
if (!found_group)
--- 1.60/sql/sql_string.h 2005-12-14 02:21:49 +03:00
+++ 1.61/sql/sql_string.h 2006-05-18 15:24:29 +04:00
@@ -24,8 +24,6 @@
#define NOT_FIXED_DEC 31
#endif
-#define STRING_WITH_LEN(X) ((const char*) X), ((uint) (sizeof(X) - 1))
-
class String;
int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
--- 1.58/sql/structs.h 2006-01-07 16:41:42 +03:00
+++ 1.59/sql/structs.h 2006-05-18 15:24:29 +04:00
@@ -20,22 +20,6 @@
struct st_table;
class Field;
-typedef struct st_lex_string
-{
- char *str;
- uint length;
-} LEX_STRING;
-
-typedef struct st_lex_string_with_init :public st_lex_string
-{
- st_lex_string_with_init(const char *str_arg, uint length_arg)
- {
- str= (char*) str_arg;
- length= length_arg;
- }
-} LEX_STRING_WITH_INIT;
-
-
typedef struct st_date_time_format {
uchar positions[8];
char time_separator; /* Separator between hour and minute */
--- 1.49/support-files/mysql.server.sh 2006-04-06 21:13:39 +04:00
+++ 1.50/support-files/mysql.server.sh 2006-05-18 15:24:29 +04:00
@@ -265,7 +265,10 @@
then
# Give extra arguments to mysqld with the my.cnf file. This script may
# be overwritten at next upgrade.
- $manager --user=$user --pid-file=$pid_file >/dev/null 2>&1 &
+ "$manager" \
+ --mysqld-safe-compatible \
+ --user="$user" \
+ --pid-file="$pid_file" >/dev/null 2>&1 &
wait_for_pid created
# Make lock for RedHat / SuSE
--- New file ---
+++ mysql-test/r/im_cmd_line.result 06/05/18 15:24:29
--> 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
--- 1.1/mysql-test/r/im_daemon_life_cycle.result 2005-10-01 01:14:36 +04:00
+++ 1.2/mysql-test/r/im_daemon_life_cycle.result 2006-05-18 15:24:28 +04:00
@@ -1,5 +1,5 @@
SHOW INSTANCES;
-instance_name status
+instance_name state
mysqld1 online
mysqld2 offline
Killing the process...
--- New file ---
+++ mysql-test/r/im_instance_conf.result 06/05/18 15:24:30
--------------------------------------------------------------------
server_id =1
server_id =2
--------------------------------------------------------------------
SHOW INSTANCES;
instance_name state
mysqld1 online
mysqld2 offline
---> connection: mysql1_con
SHOW VARIABLES LIKE 'server_id';
Variable_name Value
server_id 1
---> connection: default
CREATE INSTANCE mysqld3;
SHOW INSTANCES;
instance_name state
mysqld3 offline
mysqld2 offline
mysqld1 online
--------------------------------------------------------------------
server_id =1
server_id =2
--------------------------------------------------------------------
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;
SHOW INSTANCES;
instance_name state
mysqld3 offline
mysqld4 offline
mysqld1 online
mysqld2 offline
--------------------------------------------------------------------
nonguarded
nonguarded
--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------
CREATE INSTANCE mysqld5 test-A = 000, test-B = test;
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 ;
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=' ';
SHOW INSTANCES;
instance_name state
mysqld1 online
mysqld2 offline
mysqld5 offline
mysqld6 offline
mysqld3 offline
mysqld4 offline
mysqld9 offline
CREATE INSTANCE mysqld9a test-3='\b\babc\sdef';
SHOW INSTANCES;
instance_name state
mysqld1 online
mysqld9a offline
mysqld5 offline
mysqld6 offline
mysqld3 offline
mysqld4 offline
mysqld9 offline
mysqld2 offline
CREATE INSTANCE mysqld9b test-4='abc\tdef', test-5='abc\ndef';
SHOW INSTANCES;
instance_name state
mysqld9b offline
mysqld9a offline
mysqld5 offline
mysqld6 offline
mysqld3 offline
mysqld4 offline
mysqld9 offline
mysqld2 offline
mysqld1 online
CREATE INSTANCE mysqld9c test-6="abc\rdef", test-7="abc\\def";
SHOW INSTANCES;
instance_name state
mysqld9b offline
mysqld6 offline
mysqld5 offline
mysqld9c offline
mysqld3 offline
mysqld4 offline
mysqld9 offline
mysqld2 offline
mysqld1 online
mysqld9a offline
CREATE INSTANCE mysqld10 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
mysqld9b offline
mysqld6 offline
mysqld5 offline
mysqld9c offline
mysqld3 offline
mysqld4 offline
mysqld9 offline
mysqld2 offline
mysqld1 online
mysqld9a 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.
--- 1.5/mysql-test/r/im_life_cycle.result 2006-02-18 18:00:18 +03:00
+++ 1.6/mysql-test/r/im_life_cycle.result 2006-05-18 15:24:28 +04:00
@@ -1,69 +1,93 @@
+
+--------------------------------------------------------------------
+-- 1.1.1.
+--------------------------------------------------------------------
SHOW INSTANCES;
-instance_name status
+instance_name state
mysqld1 online
mysqld2 offline
-SHOW INSTANCE STATUS mysqld1;
-instance_name status version_number version
-mysqld1 online VERSION_NUMBER VERSION
-SHOW INSTANCE STATUS mysqld2;
-instance_name status version_number version
-mysqld2 offline VERSION_NUMBER VERSION
+
+--------------------------------------------------------------------
+-- 1.1.2.
+--------------------------------------------------------------------
START INSTANCE mysqld2;
SHOW INSTANCES;
-instance_name status
+instance_name state
mysqld1 online
mysqld2 online
-SHOW INSTANCE STATUS mysqld1;
-instance_name status version_number version
-mysqld1 online VERSION_NUMBER VERSION
-SHOW INSTANCE STATUS mysqld2;
-instance_name status version_number version
-mysqld2 online VERSION_NUMBER VERSION
SHOW VARIABLES LIKE 'port';
Variable_name Value
-port IM_MYSQLD1_PORT
+port IM_MYSQLD2_PORT
+
+--------------------------------------------------------------------
+-- 1.1.3.
+--------------------------------------------------------------------
STOP INSTANCE mysqld2;
SHOW INSTANCES;
-instance_name status
+instance_name state
mysqld1 online
mysqld2 offline
SHOW INSTANCE STATUS mysqld1;
-instance_name status version_number version
-mysqld1 online VERSION_NUMBER VERSION
+instance_name state version_number version mysqld_compatible
+mysqld1 online VERSION_NUMBER VERSION no
SHOW INSTANCE STATUS mysqld2;
-instance_name status version_number version
-mysqld2 offline VERSION_NUMBER VERSION
+instance_name state version_number version mysqld_compatible
+mysqld2 offline VERSION_NUMBER VERSION no
+
+--------------------------------------------------------------------
+-- 1.1.4.
+--------------------------------------------------------------------
START INSTANCE mysqld3;
ERROR HY000: Bad instance name. Check that the instance with such a name exists
START INSTANCE mysqld1;
ERROR HY000: The instance is already started
+
+--------------------------------------------------------------------
+-- 1.1.5.
+--------------------------------------------------------------------
STOP INSTANCE mysqld3;
ERROR HY000: Bad instance name. Check that the instance with such a name exists
+
+--------------------------------------------------------------------
+-- 1.1.6.
+--------------------------------------------------------------------
SHOW INSTANCES;
-instance_name status
+instance_name state
mysqld1 online
mysqld2 offline
Killing the process...
Sleeping...
Success: the process was restarted.
+
+--------------------------------------------------------------------
+-- 1.1.7.
+--------------------------------------------------------------------
SHOW INSTANCES;
-instance_name status
+instance_name state
mysqld1 online
mysqld2 offline
START INSTANCE mysqld2;
SHOW INSTANCES;
-instance_name status
+instance_name state
mysqld1 online
mysqld2 online
Killing the process...
Sleeping...
Success: the process was killed.
SHOW INSTANCES;
-instance_name status
+instance_name state
mysqld1 online
mysqld2 offline
+
+--------------------------------------------------------------------
+-- 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;
--- New file ---
+++ mysql-test/r/im_options.result 06/05/18 15:24:30
--------------------------------------------------------------------
server_id =1
server_id =2
--------------------------------------------------------------------
SHOW VARIABLES LIKE 'server_id';
Variable_name Value
server_id 1
SHOW INSTANCES;
instance_name state
mysqld1 starting
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 = '/';
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
skip-stack-trace option_value
skip-innodb option_value
skip-bdb option_value
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
skip-stack-trace option_value
skip-innodb option_value
skip-bdb option_value
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: Bad instance name. Check that the instance with such a name exists
--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------
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: Bad instance name. Check that the instance with such a name exists
--------------------------------------------------------------------
server_id =1
server_id=2
--------------------------------------------------------------------
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
--------------------------------------------------------------------
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;
--- 1.3/mysql-test/r/im_utils.result 2006-01-27 13:41:11 +03:00
+++ 1.4/mysql-test/r/im_utils.result 2006-05-18 15:24:28 +04:00
@@ -1,11 +1,10 @@
SHOW INSTANCES;
-instance_name status
+instance_name state
mysqld1 online
mysqld2 offline
SHOW INSTANCE OPTIONS mysqld1;
option_name value
instance_name VALUE
-mysqld-path VALUE
socket VALUE
pid-file VALUE
port VALUE
@@ -25,8 +24,6 @@
SHOW INSTANCE OPTIONS mysqld2;
option_name value
instance_name VALUE
-mysqld-path VALUE
-nonguarded VALUE
socket VALUE
pid-file VALUE
port VALUE
@@ -42,6 +39,7 @@
skip-innodb VALUE
skip-bdb VALUE
skip-ndbcluster VALUE
+nonguarded VALUE
log-output VALUE
START INSTANCE mysqld2;
STOP INSTANCE mysqld2;
--- New file ---
+++ mysql-test/t/im_cmd_line.imtest 06/05/18 15:24:30
###########################################################################
#
# Tests for user-management command-line options.
#
###########################################################################
--source include/im_check_os.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" --passwd --username=testuser
--password=abc | tail -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" --passwd --username=testuser
--password=xyz | tail -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
--- 1.2/mysql-test/t/im_daemon_life_cycle-im.opt 2006-01-24 10:30:47 +03:00
+++ 1.3/mysql-test/t/im_daemon_life_cycle-im.opt 2006-05-18 15:24:28 +04:00
@@ -1,2 +1,3 @@
--run-as-service
--log=$MYSQLTEST_VARDIR/log/im.log
+--monitoring-interval=1
--- 1.1/mysql-test/t/im_daemon_life_cycle.imtest 2005-10-01 01:14:38 +04:00
+++ 1.2/mysql-test/t/im_daemon_life_cycle.imtest 2006-05-18 15:24:28 +04:00
@@ -10,6 +10,9 @@
###########################################################################
+--sleep 3
+# should be longer than monitoring interval and enough to start instance.
+
SHOW INSTANCES;
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted
--- New file ---
+++ mysql-test/t/im_instance_conf-im.opt 06/05/18 15:24:30
--monitoring-interval=1
--- New file ---
+++ mysql-test/t/im_instance_conf.imtest 06/05/18 15:24:30
###########################################################################
#
# 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;
#
###########################################################################
--source include/im_check_os.inc
###########################################################################
#
# Check starting conditions.
#
###########################################################################
# Check that the configuration file contains only instances that we expect.
--echo --------------------------------------------------------------------
--exec grep server_id $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
# Check that mysqld1 is reported as running.
--sleep 3
# should be longer than monitoring interval and enough to start instance.
SHOW INSTANCES;
# Check that the expected mysqld instance is actually run (check that we can
# connect and execute something).
--echo
--echo ---> connection: mysql1_con
--connect (mysql1_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
--connection mysql1_con
SHOW VARIABLES LIKE 'server_id';
--disconnect mysql1_con
--echo
--echo ---> connection: default
--connection default
###########################################################################
#
# 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;
SHOW INSTANCES;
--echo --------------------------------------------------------------------
--exec grep server_id $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;
SHOW INSTANCES;
--echo --------------------------------------------------------------------
--exec grep nonguarded $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
# - with value;
--echo --------------------------------------------------------------------
--exec grep test-A $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep test-B $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
CREATE INSTANCE mysqld5 test-A = 000, test-B = test;
SHOW INSTANCES;
--echo --------------------------------------------------------------------
--exec grep test-A $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-B $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-C $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
CREATE INSTANCE mysqld6 test-C1 = 10 , test-C2 = 02 ;
SHOW INSTANCES;
--echo --------------------------------------------------------------------
--exec grep test-C1 $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-C2 $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
# - check handling of grammar error;
--echo --------------------------------------------------------------------
--exec grep test-D $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep test-E $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 $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep test-E $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
# - check parsing of string option values
--echo --------------------------------------------------------------------
--exec grep test-1 $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep test-2 $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep test-3 $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep test-4 $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
CREATE INSTANCE mysqld9 test-1=" hello world ", test-2=' ';
SHOW INSTANCES;
CREATE INSTANCE mysqld9a test-3='\b\babc\sdef';
# test-3='abc def'
SHOW INSTANCES;
CREATE INSTANCE mysqld9b test-4='abc\tdef', test-5='abc\ndef';
SHOW INSTANCES;
CREATE INSTANCE mysqld9c test-6="abc\rdef", test-7="abc\\def";
# test-6=abc
SHOW INSTANCES;
--error ER_SYNTAX_ERROR
CREATE INSTANCE mysqld10 test-bad=' \ ';
SHOW INSTANCES;
--echo --------------------------------------------------------------------
--exec grep test-1 $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-2 $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-3 $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-4 $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-5 $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-6 $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-7 $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;
--- New file ---
+++ mysql-test/t/im_life_cycle-im.opt 06/05/18 15:24:31
--monitoring-interval=1
--- 1.5/mysql-test/t/im_life_cycle.imtest 2006-02-18 18:00:18 +03:00
+++ 1.6/mysql-test/t/im_life_cycle.imtest 2006-05-18 15:24:28 +04:00
@@ -17,11 +17,15 @@
#
###########################################################################
+--echo
+--echo --------------------------------------------------------------------
+--echo -- 1.1.1.
+--echo --------------------------------------------------------------------
+
+--sleep 3
+# should be longer than monitoring interval and enough to start instance.
+
SHOW INSTANCES;
---replace_column 3 VERSION_NUMBER 4 VERSION
-SHOW INSTANCE STATUS mysqld1;
---replace_column 3 VERSION_NUMBER 4 VERSION
-SHOW INSTANCE STATUS mysqld2;
###########################################################################
#
@@ -33,20 +37,22 @@
#
###########################################################################
+--echo
+--echo --------------------------------------------------------------------
+--echo -- 1.1.2.
+--echo --------------------------------------------------------------------
+
START INSTANCE mysqld2;
-# FIXME
+# FIXME: START INSTANCE should be synchronous.
--sleep 3
+# should be longer than monitoring interval and enough to start instance.
SHOW INSTANCES;
---replace_column 3 VERSION_NUMBER 4 VERSION
-SHOW INSTANCE STATUS mysqld1;
---replace_column 3 VERSION_NUMBER 4 VERSION
-SHOW INSTANCE STATUS mysqld2;
---connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
+--connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD2_PORT,$IM_MYSQLD2_SOCK)
--connection mysql_con
---replace_result $IM_MYSQLD1_PORT IM_MYSQLD1_PORT
+--replace_result $IM_MYSQLD2_PORT IM_MYSQLD2_PORT
SHOW VARIABLES LIKE 'port';
--connection default
@@ -61,9 +67,15 @@
#
###########################################################################
+--echo
+--echo --------------------------------------------------------------------
+--echo -- 1.1.3.
+--echo --------------------------------------------------------------------
+
STOP INSTANCE mysqld2;
-# FIXME
+# FIXME: STOP INSTANCE should be synchronous.
--sleep 3
+# should be longer than monitoring interval and enough to stop instance.
SHOW INSTANCES;
--replace_column 3 VERSION_NUMBER 4 VERSION
@@ -81,16 +93,17 @@
#
###########################################################################
---error 3000
+--echo
+--echo --------------------------------------------------------------------
+--echo -- 1.1.4.
+--echo --------------------------------------------------------------------
+
+--error 3000 # ER_BAD_INSTANCE_NAME
START INSTANCE mysqld3;
---error 3002
+--error 3002 # ER_INSTANCE_ALREADY_STARTED
START INSTANCE mysqld1;
-# FIXME TODO
-# BUG#12813: START/STOP INSTANCE commands accept a list as argument
-# START INSTANCE mysqld1, mysqld2;
-
###########################################################################
#
# 1.1.5. Check that Instance Manager reports correct errors for 'STOP INSTANCE'
@@ -101,39 +114,54 @@
#
###########################################################################
---error 3000
+--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
+# --error 3002 # ER_INSTANCE_ALREADY_STARTED
# STOP INSTANCE mysqld2;
-# FIXME TODO
-# BUG#12813: START/STOP INSTANCE commands accept a list as argument
-# STOP INSTANCE mysqld1, mysqld2;
-
###########################################################################
#
# 1.1.6. Check that Instance Manager is able to restart guarded instances.
#
###########################################################################
+--echo
+--echo --------------------------------------------------------------------
+--echo -- 1.1.6.
+--echo --------------------------------------------------------------------
+
SHOW INSTANCES;
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted
+--sleep 3
+# should be longer than monitoring interval and enough to start instance.
+
###########################################################################
#
# 1.1.7. Check that Instance Manager does not restart non-guarded instance.
#
###########################################################################
+--echo
+--echo --------------------------------------------------------------------
+--echo -- 1.1.7.
+--echo --------------------------------------------------------------------
+
SHOW INSTANCES;
START INSTANCE mysqld2;
-# FIXME
+# FIXME: START INSTANCE should be synchronous.
--sleep 3
+# should be longer than monitoring interval and enough to start instance.
SHOW INSTANCES;
@@ -147,7 +175,13 @@
# incomplete SHOW INSTANCE STATUS command.
#
###########################################################################
---error 1149
+
+--echo
+--echo --------------------------------------------------------------------
+--echo -- 1.1.8.
+--echo --------------------------------------------------------------------
+
+--error ER_SYNTAX_ERROR
SHOW INSTANCE STATUS;
#
@@ -159,8 +193,13 @@
# a list as argument.
#
---error 1149
+--echo
+--echo --------------------------------------------------------------------
+--echo -- BUG#12813
+--echo --------------------------------------------------------------------
+
+--error ER_SYNTAX_ERROR
START INSTANCE mysqld1,mysqld2,mysqld3;
---error 1149
+--error ER_SYNTAX_ERROR
STOP INSTANCE mysqld1,mysqld2,mysqld3;
--- New file ---
+++ mysql-test/t/im_options.imtest 06/05/18 15:24:31
###########################################################################
#
# 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)
#
###########################################################################
--source include/im_check_os.inc
###########################################################################
#
# Check starting conditions.
#
###########################################################################
# - check the configuration file;
--echo --------------------------------------------------------------------
--exec grep server_id $MYSQLTEST_VARDIR/im.cnf ;
--echo --------------------------------------------------------------------
# - check the running instances.
--connect (mysql1_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
--connection mysql1_con
SHOW VARIABLES LIKE 'server_id';
--connection default
# - check the internal cache.
SHOW INSTANCES;
###########################################################################
#
# 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 = '/';
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 $MYSQLTEST_VARDIR/im.cnf ;
--echo --------------------------------------------------------------------
--exec grep ddd $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 $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep ddd $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 $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 $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 $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 $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 $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 $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 $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;
--- New file ---
+++ mysql-test/t/im_utils-im.opt 06/05/18 15:24:31
--monitoring-interval=1
--- 1.1/mysql-test/t/im_utils.imtest 2005-10-01 01:14:39 +04:00
+++ 1.2/mysql-test/t/im_utils.imtest 2006-05-18 15:24:28 +04:00
@@ -17,6 +17,9 @@
# - the second instance is offline;
#
+--sleep 3
+# should be longer than monitoring interval and enough to start instance.
+
SHOW INSTANCES;
#
@@ -41,8 +44,9 @@
START INSTANCE mysqld2;
-# FIXME
--- sleep 3
+# FIXME: START INSTANCE should be synchronous.
+--sleep 3
+# should be longer than monitoring interval and enough to start instance.
STOP INSTANCE mysqld2;
--- New file ---
+++ server-tools/instance-manager/exit_codes.h 06/05/18 15:24:31
#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; either version 2 of the License, or
(at your option) any later version.
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
--- New file ---
+++ server-tools/instance-manager/user_management_commands.cc 06/05/18 15:24:31
#if defined(__GNUC__) && defined(USE_PRAGMA_IMPLEMENTATION)
#pragma implementation
#endif
#include "user_management_commands.h"
#include "exit_codes.h"
#include "options.h"
#include "user_map.h"
/*************************************************************************
Module-specific (internal) functions.
*************************************************************************/
/*
The function returns user name. The user name is retrieved from command-line
options (if specified) or from console.
NOTE
This function must not be used in user-management command implementations.
Use get_user_name() instead.
SYNOPSYS
get_user_name_impl()
RETURN
NULL on error
valid pointer on success
*/
static char *get_user_name_impl()
{
static char user_name_buf[1024];
char *ptr;
if (Options::User_management::user_name)
return Options::User_management::user_name;
printf("Enter user name: ");
fflush(stdout);
if (!fgets(user_name_buf, sizeof (user_name_buf), stdin))
return NULL;
if ((ptr= strchr(user_name_buf, '\n')))
*ptr= 0;
if ((ptr= strchr(user_name_buf, '\r')))
*ptr= 0;
return user_name_buf;
}
/*
The function is intended to provide user name for user-management
operations. It also checks that length of the specified user name is correct
(not empty, not exceeds USERNAME_LENGTH). Report to stderr if something is
wrong.
SYNOPSYS
get_user_name()
user_name [OUT] on success contains user name
RETURN
TRUE on error
FALSE on success
*/
static bool get_user_name(LEX_STRING *user_name)
{
char *user_name_str= get_user_name_impl();
if (!user_name_str)
{
fprintf(stderr, "Error: unable to read user name from stdin.\n");
return TRUE;
}
user_name->str= user_name_str;
user_name->length= strlen(user_name->str);
if (user_name->length == 0)
{
fprintf(stderr, "Error: user name can not be empty.\n");
return TRUE;
}
if (user_name->length > USERNAME_LENGTH)
{
fprintf(stderr, "Error: user name must not exceed %d characters.\n",
(int) USERNAME_LENGTH);
return TRUE;
}
return FALSE;
}
/*
The function is intended to provide password for user-management operations.
The password is retrieved from command-line options (if specified) or from
console.
SYNOPSYS
get_password()
RETURN
NULL on error
valid pointer on success
*/
static const char *get_password()
{
if (Options::User_management::password)
return Options::User_management::password;
const char *passwd1= get_tty_password("Enter password: ");
const char *passwd2= get_tty_password("Re-type password: ");
if (strcmp(passwd1, passwd2))
{
fprintf(stderr, "Error: passwords do not match.\n");
return 0;
}
return passwd1;
}
/*
Load password file into user map.
SYNOPSYS
load_password_file()
user_map target user map
RETURN
See exit_codes.h for possible values.
*/
static int load_password_file(User_map *user_map)
{
int err_code;
const char *err_msg;
if (user_map->init())
{
fprintf(stderr, "Error: can not initialize user map.\n");
return ERR_OUT_OF_MEMORY;
}
if ((err_code= user_map->load(Options::Main::password_file_name, &err_msg)))
fprintf(stderr, "Error: %s.\n", (const char *) err_msg);
return err_code;
}
/*
Save user map into password file.
SYNOPSYS
save_password_file()
user_map user map
RETURN
See exit_codes.h for possible values.
*/
static int save_password_file(User_map *user_map)
{
int err_code;
const char *err_msg;
if ((err_code= user_map->save(Options::Main::password_file_name, &err_msg)))
fprintf(stderr, "Error: %s.\n", (const char *) err_msg);
return err_code;
}
/*************************************************************************
Passwd_cmd
*************************************************************************/
int Passwd_cmd::execute()
{
LEX_STRING user_name;
const char *password;
printf("Creating record for new user.\n");
if (get_user_name(&user_name))
return ERR_CAN_NOT_READ_USER_NAME;
if (!(password= get_password()))
return ERR_CAN_NOT_READ_PASSWORD;
{
User user(&user_name, password);
printf("%s:%s\n",
(const char *) user.user,
(const char *) user.scrambled_password);
}
return ERR_OK;
}
/*************************************************************************
Add_user_cmd
*************************************************************************/
int Add_user_cmd::execute()
{
LEX_STRING user_name;
const char *password;
char scrambled_password_buf[SCRAMBLED_PASSWORD_CHAR_LENGTH + 1];
User_map user_map;
User *new_user;
int err_code;
if (get_user_name(&user_name))
return ERR_CAN_NOT_READ_USER_NAME;
/* Load the password file. */
if ((err_code= load_password_file(&user_map)) != ERR_OK)
return err_code;
/* Check that the user does not exist. */
if (user_map.find_user(&user_name))
{
fprintf(stderr, "Error: user '%s' already exists.\n",
(const char *) user_name.str);
return ERR_USER_ALREADY_EXISTS;
}
/* Add the user. */
if (!(password= get_password()))
return ERR_CAN_NOT_READ_PASSWORD;
if (!(new_user= new User(&user_name, password)))
return ERR_OUT_OF_MEMORY;
if (user_map.add_user(new_user))
{
delete new_user;
return ERR_OUT_OF_MEMORY;
}
/* Save the password file. */
return save_password_file(&user_map);
}
/*************************************************************************
Drop_user_cmd
*************************************************************************/
int Drop_user_cmd::execute()
{
LEX_STRING user_name;
User_map user_map;
User *user;
int err_code;
if (get_user_name(&user_name))
return ERR_CAN_NOT_READ_USER_NAME;
/* Load the password file. */
if ((err_code= load_password_file(&user_map)) != ERR_OK)
return err_code;
/* Find the user. */
user= user_map.find_user(&user_name);
if (!user)
{
fprintf(stderr, "Error: user '%s' does not exist.\n",
(const char *) user_name.str);
return ERR_USER_NOT_FOUND;
}
/* Remove the user (ignore possible errors). */
user_map.remove_user(user);
/* Save the password file. */
return save_password_file(&user_map);
}
/*************************************************************************
Edit_user_cmd
*************************************************************************/
int Edit_user_cmd::execute()
{
LEX_STRING user_name;
const char *password;
char scrambled_password_buf[SCRAMBLED_PASSWORD_CHAR_LENGTH + 1];
User_map user_map;
User *user;
int err_code;
if (get_user_name(&user_name))
return ERR_CAN_NOT_READ_USER_NAME;
/* Load the password file. */
if ((err_code= load_password_file(&user_map)) != ERR_OK)
return err_code;
/* Find the user. */
user= user_map.find_user(&user_name);
if (!user)
{
fprintf(stderr, "Error: user '%s' does not exist.\n",
(const char *) user_name.str);
return ERR_USER_NOT_FOUND;
}
/* Modify user's password. */
if (!(password= get_password()))
return ERR_CAN_NOT_READ_PASSWORD;
user->set_password(password);
/* Save the password file. */
return save_password_file(&user_map);
}
/*************************************************************************
Clean_db_cmd
*************************************************************************/
int Clean_db_cmd::execute()
{
User_map user_map;
if (user_map.init())
{
fprintf(stderr, "Error: can not initialize user map.\n");
return ERR_OUT_OF_MEMORY;
}
return save_password_file(&user_map);
}
/*************************************************************************
Check_db_cmd
*************************************************************************/
int Check_db_cmd::execute()
{
User_map user_map;
return load_password_file(&user_map);
}
/*************************************************************************
List_users_cmd
*************************************************************************/
int List_users_cmd::execute()
{
User_map user_map;
int err_code;
/* Load the password file. */
if ((err_code= load_password_file(&user_map)))
return err_code;
/* Print out registered users. */
{
User_map::Iterator it(&user_map);
User *user;
while ((user= it.next()))
fprintf(stderr, "%s\n", (const char *) user->user);
}
return ERR_OK;
}
--- New file ---
+++ server-tools/instance-manager/user_management_commands.h 06/05/18 15:24:32
#ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_USER_MANAGEMENT_CMD_H
#define INCLUDES_MYSQL_INSTANCE_MANAGER_USER_MANAGEMENT_CMD_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; either version 2 of the License, or
(at your option) any later version.
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 header contains declarations of classes inteded to support
user-management commands (such as add user, get list of users, etc).
The general idea is to have one interface (pure abstract class) for such a
command. Each concrete user-management command is implemented in concrete
class, derived from the common interface.
*/
#if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE)
#pragma interface
#endif
/*************************************************************************
User_management_cmd -- base class for User-management commands.
*************************************************************************/
class User_management_cmd
{
public:
User_management_cmd()
{ }
virtual ~User_management_cmd()
{ }
public:
/*
Executes user-management command.
SYNOPSYS
execute()
RETURN
See exit_codes.h for possible values.
*/
virtual int execute() = 0;
};
/*************************************************************************
Passwd_cmd: support for --passwd command-line option.
*************************************************************************/
class Passwd_cmd : public User_management_cmd
{
public:
Passwd_cmd()
{ }
public:
virtual int execute();
};
/*************************************************************************
Add_user_cmd: support for --add-user command-line option.
*************************************************************************/
class Add_user_cmd : public User_management_cmd
{
public:
Add_user_cmd()
{ }
public:
virtual int execute();
};
/*************************************************************************
Drop_user_cmd: support for --drop-user command-line option.
*************************************************************************/
class Drop_user_cmd : public User_management_cmd
{
public:
Drop_user_cmd()
{ }
public:
virtual int execute();
};
/*************************************************************************
Edit_user_cmd: support for --edit-user command-line option.
*************************************************************************/
class Edit_user_cmd : public User_management_cmd
{
public:
Edit_user_cmd()
{ }
public:
virtual int execute();
};
/*************************************************************************
Clean_db_cmd: support for --clean-db command-line option.
*************************************************************************/
class Clean_db_cmd : public User_management_cmd
{
public:
Clean_db_cmd()
{ }
public:
virtual int execute();
};
/*************************************************************************
Check_db_cmd: support for --check-db command-line option.
*************************************************************************/
class Check_db_cmd : public User_management_cmd
{
public:
Check_db_cmd()
{ }
public:
virtual int execute();
};
/*************************************************************************
List_users_cmd: support for --list-users command-line option.
*************************************************************************/
class List_users_cmd : public User_management_cmd
{
public:
List_users_cmd()
{ }
public:
virtual int execute();
};
#endif // INCLUDES_MYSQL_INSTANCE_MANAGER_USER_MANAGEMENT_CMD_H
--- 1.27/sql/spatial.cc 2006-02-12 06:26:43 +03:00
+++ 1.28/sql/spatial.cc 2006-05-18 15:24:29 +04:00
@@ -34,8 +34,11 @@
Geometry::Class_info::Class_info(const char *name, int type_id,
void(*create_func)(void *)):
- m_name(name, strlen(name)), m_type_id(type_id), m_create_func(create_func)
+ m_type_id(type_id), m_create_func(create_func)
{
+ m_name.str= (char *) name;
+ m_name.length= strlen(name);
+
ci_collection[type_id]= this;
}
--- 1.19/sql/spatial.h 2006-02-25 18:46:26 +03:00
+++ 1.20/sql/spatial.h 2006-05-18 15:24:29 +04:00
@@ -200,7 +200,7 @@
class Class_info
{
public:
- LEX_STRING_WITH_INIT m_name;
+ LEX_STRING m_name;
int m_type_id;
void (*m_create_func)(void *);
Class_info(const char *name, int type_id, void(*create_func)(void *));
--- 1.54/sql/sql_trigger.cc 2006-03-28 07:46:22 +04:00
+++ 1.55/sql/sql_trigger.cc 2006-05-18 15:24:29 +04:00
@@ -1412,8 +1412,8 @@
}
if (table.triggers)
{
- LEX_STRING_WITH_INIT old_table_name(old_table, strlen(old_table));
- LEX_STRING_WITH_INIT new_table_name(new_table, strlen(new_table));
+ LEX_STRING old_table_name= { (char *) STRING_WITH_LEN(old_table) };
+ LEX_STRING new_table_name= { (char *) STRING_WITH_LEN(new_table) };
/*
Since triggers should be in the same schema as their subject tables
moving table with them between two schemas raises too many questions.
--- 1.11/mysys/default_modify.c 2006-01-03 19:54:34 +03:00
+++ 1.12/mysys/default_modify.c 2006-05-18 15:24:28 +04:00
@@ -40,11 +40,13 @@
SYNOPSYS
modify_defaults_file()
file_location The location of configuration file to edit
- option option to look for
- option value The value of the option we would like to set
- section_name the name of the section
- remove_option This is true if we want to remove the option.
- False otherwise.
+ option The name of the option to look for (can be NULL)
+ option value The value of the option we would like to set (can be NULL)
+ section_name The name of the section (must be NOT NULL)
+ remove_option This defines what we want to remove:
+ - MY_REMOVE_NONE -- nothing to remove;
+ - MY_REMOVE_OPTION -- remove the specified option;
+ - MY_REMOVE_SECTION -- remove the specified section;
IMPLEMENTATION
We open the option file first, then read the file line-by-line,
looking for the section we need. At the same time we put these lines
@@ -67,7 +69,9 @@
FILE *cnf_file;
MY_STAT file_stat;
char linebuff[BUFF_SIZE], *src_ptr, *dst_ptr, *file_buffer;
- uint opt_len, optval_len, sect_len, nr_newlines= 0, buffer_size;
+ uint opt_len= 0;
+ uint optval_len= 0;
+ uint sect_len, nr_newlines= 0, buffer_size;
my_bool in_section= FALSE, opt_applied= 0;
uint reserve_extended;
uint new_opt_len;
@@ -81,8 +85,11 @@
if (my_fstat(fileno(cnf_file), &file_stat, MYF(0)))
goto malloc_err;
- opt_len= (uint) strlen(option);
- optval_len= (uint) strlen(option_value);
+ if (option && option_value)
+ {
+ opt_len= (uint) strlen(option);
+ optval_len= (uint) strlen(option_value);
+ }
new_opt_len= opt_len + 1 + optval_len + NEWLINE_LEN;
@@ -119,8 +126,8 @@
continue;
}
- /* correct the option */
- if (in_section && !strncmp(src_ptr, option, opt_len) &&
+ /* correct the option (if requested) */
+ if (option && in_section && !strncmp(src_ptr, option, opt_len)
&&
(*(src_ptr + opt_len) == '=' ||
my_isspace(&my_charset_latin1, *(src_ptr + opt_len)) ||
*(src_ptr + opt_len) == '\0'))
@@ -143,7 +150,12 @@
}
else
{
- /* If going to new group and we have option to apply, do it now */
+ /*
+ If we are going to the new group and have an option to apply, do
+ it now. If we are removing a single option or the whole section
+ this will only trigger opt_applied flag.
+ */
+
if (in_section && !opt_applied && *src_ptr == '[')
{
dst_ptr= add_option(dst_ptr, option_value, option, remove_option);
@@ -153,7 +165,10 @@
for (; nr_newlines; nr_newlines--)
dst_ptr= strmov(dst_ptr, NEWLINE);
- dst_ptr= strmov(dst_ptr, linebuff);
+
+ /* Skip the section if MY_REMOVE_SECTION was given */
+ if (!in_section || remove_option != MY_REMOVE_SECTION)
+ dst_ptr= strmov(dst_ptr, linebuff);
}
/* Look for a section */
if (*src_ptr == '[')
@@ -167,18 +182,31 @@
{}
if (*src_ptr != ']')
+ {
+ in_section= FALSE;
continue; /* Missing closing parenthesis. Assume this was no group */
+ }
+
+ if (remove_option == MY_REMOVE_SECTION)
+ dst_ptr= dst_ptr - strlen(linebuff);
+
in_section= TRUE;
}
else
in_section= FALSE; /* mark that this section is of no interest to us */
}
}
- /* File ended. */
- if (!opt_applied && !remove_option && in_section)
+
+ /*
+ File ended. Apply an option or set opt_applied flag (in case of
+ MY_REMOVE_SECTION) so that the changes are saved. Do not do anything
+ if we are removing non-existent option.
+ */
+
+ if (!opt_applied && in_section && (remove_option != MY_REMOVE_OPTION))
{
/* New option still remains to apply at the end */
- if (*(dst_ptr - 1) != '\n')
+ if (!remove_option && *(dst_ptr - 1) != '\n')
dst_ptr= strmov(dst_ptr, NEWLINE);
dst_ptr= add_option(dst_ptr, option_value, option, remove_option);
opt_applied= 1;
--- 1.112/mysql-test/mysql-test-run.pl 2006-05-01 11:14:28 +04:00
+++ 1.113/mysql-test/mysql-test-run.pl 2006-05-18 15:24:28 +04:00
@@ -1211,8 +1211,11 @@
$ENV{'NDBCLUSTER_PORT_SLAVE'}=$opt_ndbcluster_port_slave;
$ENV{'NDB_STATUS_OK'}= "YES";
+ $ENV{'IM_EXE'}= $exe_im;
$ENV{'IM_PATH_PID'}= $instance_manager->{path_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};
--- 1.34/server-tools/instance-manager/Makefile.am 2006-03-25 00:50:46 +03:00
+++ 1.35/server-tools/instance-manager/Makefile.am 2006-05-18 15:24:28 +04:00
@@ -76,7 +76,10 @@
guardian.cc guardian.h \
parse_output.cc parse_output.h \
mysql_manager_error.h \
- portability.h
+ portability.h \
+ exit_codes.h \
+ user_management_commands.h \
+ user_management_commands.cc
mysqlmanager_LDADD= @CLIENT_EXTRA_LDFLAGS@ \
liboptions.la \
@@ -89,6 +92,9 @@
EXTRA_DIST = WindowsService.cpp WindowsService.h IMService.cpp \
IMService.h cmakelists.txt
+
+AM_CFLAGS = -Werror
+AM_CXXFLAGS = -Werror
tags:
ctags -R *.h *.cc
--- 1.25/server-tools/instance-manager/listener.cc 2006-03-14 13:13:32 +03:00
+++ 1.26/server-tools/instance-manager/listener.cc 2006-05-18 15:24:29 +04:00
@@ -19,21 +19,23 @@
#endif
#include "listener.h"
-#include "priv.h"
-#include <m_string.h>
+
+#include <my_global.h>
#include <mysql.h>
#include <violite.h>
+
+#include <sys/stat.h>
#ifndef __WIN__
#include <sys/un.h>
#endif
-#include <sys/stat.h>
-#include "thread_registry.h"
-#include "options.h"
#include "instance_map.h"
#include "log.h"
#include "mysql_connection.h"
+#include "options.h"
#include "portability.h"
+#include "priv.h"
+#include "thread_registry.h"
/*
@@ -62,8 +64,7 @@
Listener_thread::Listener_thread(const Listener_thread_args &args) :
- Listener_thread_args(args.thread_registry, args.options, args.user_map,
- args.instance_map)
+ Listener_thread_args(args.thread_registry, args.user_map, args.instance_map)
,total_connection_count(0)
,thread_info(pthread_self())
,num_sockets(0)
@@ -234,14 +235,16 @@
bzero(&ip_socket_address, sizeof(ip_socket_address));
ulong im_bind_addr;
- if (options.bind_address != 0)
+ if (Options::Main::bind_address != 0)
{
- if ((im_bind_addr= (ulong) inet_addr(options.bind_address)) == INADDR_NONE)
+ im_bind_addr= (ulong) inet_addr(Options::Main::bind_address);
+
+ if (im_bind_addr == INADDR_NONE)
im_bind_addr= htonl(INADDR_ANY);
}
else
im_bind_addr= htonl(INADDR_ANY);
- uint im_port= options.port_number;
+ uint im_port= Options::Main::port_number;
ip_socket_address.sin_family= AF_INET;
ip_socket_address.sin_addr.s_addr= im_bind_addr;
@@ -295,7 +298,7 @@
bzero(&unix_socket_address, sizeof(unix_socket_address));
unix_socket_address.sun_family= AF_UNIX;
- strmake(unix_socket_address.sun_path, options.socket_file_name,
+ strmake(unix_socket_address.sun_path, Options::Main::socket_file_name,
sizeof(unix_socket_address.sun_path));
unlink(unix_socket_address.sun_path); // in case we have stale socket file
--- 1.6/server-tools/instance-manager/listener.h 2005-10-19 00:30:49 +04:00
+++ 1.7/server-tools/instance-manager/listener.h 2006-05-18 15:24:29 +04:00
@@ -27,23 +27,19 @@
pthread_handler_t listener(void *arg);
class Thread_registry;
-struct Options;
class User_map;
class Instance_map;
struct Listener_thread_args
{
Thread_registry &thread_registry;
- const Options &options;
const User_map &user_map;
Instance_map &instance_map;
Listener_thread_args(Thread_registry &thread_registry_arg,
- const Options &options_arg,
const User_map &user_map_arg,
Instance_map &instance_map_arg) :
thread_registry(thread_registry_arg)
- ,options(options_arg)
,user_map(user_map_arg)
,instance_map(instance_map_arg)
{}
--- 1.8/server-tools/instance-manager/log.cc 2005-08-05 22:44:45 +04:00
+++ 1.9/server-tools/instance-manager/log.cc 2006-05-18 15:24:29 +04:00
@@ -14,14 +14,14 @@
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 "log.h"
-#include "portability.h"
-#include <stdarg.h>
+
+#include <my_global.h>
#include <m_string.h>
#include <my_sys.h>
+#include <stdarg.h>
+
/*
TODO:
- add flexible header support
@@ -71,7 +71,7 @@
{
int size= sizeof(buff_stack) * 2;
buff_msg= (char*) my_malloc(size, MYF(0));
- while (true)
+ while (TRUE)
{
if (buff_msg == 0)
{
--- 1.31/server-tools/instance-manager/manager.cc 2006-02-21 15:57:54 +03:00
+++ 1.32/server-tools/instance-manager/manager.cc 2006-05-18 15:24:29 +04:00
@@ -14,39 +14,55 @@
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 "manager.h"
-#include "priv.h"
-#include "thread_registry.h"
-#include "listener.h"
-#include "instance_map.h"
-#include "options.h"
-#include "user_map.h"
-#include "log.h"
-#include "guardian.h"
-
-#include <my_sys.h>
+#include <my_global.h>
#include <m_string.h>
-#include <signal.h>
+#include <my_sys.h>
#include <thr_alarm.h>
+
+#include <signal.h>
#ifndef __WIN__
#include <sys/wait.h>
#endif
+#include "exit_codes.h"
+#include "guardian.h"
+#include "instance_map.h"
+#include "listener.h"
+#include "log.h"
+#include "options.h"
+#include "priv.h"
+#include "thread_registry.h"
+#include "user_map.h"
+
static int create_pid_file(const char *pid_file_name)
{
- if (FILE *pid_file= my_fopen(pid_file_name,
- O_WRONLY | O_CREAT | O_BINARY, MYF(0)))
+ FILE *pid_file;
+
+ if (!(pid_file= my_fopen(pid_file_name, O_WRONLY | O_CREAT | O_BINARY,
+ MYF(0))))
{
- fprintf(pid_file, "%d\n", (int) getpid());
- my_fclose(pid_file, MYF(0));
- return 0;
- }
- log_error("can't create pid file %s: errno=%d, %s",
- pid_file_name, errno, strerror(errno));
- return 1;
+ log_error("Error: can not create pid file '%s': %s (errno: %d)",
+ (const char *) pid_file_name,
+ (const char *) strerror(errno),
+ (int) errno);
+ return 1;
+ }
+
+ if (fprintf(pid_file, "%d\n", (int) getpid()) <= 0)
+ {
+ log_error("Error: can not write to pid file '%s': %s (errno: %d)",
+ (const char *) pid_file_name,
+ (const char *) strerror(errno),
+ (int) errno);
+ return 1;
+ }
+
+ my_fclose(pid_file, MYF(0));
+
+ return 0;
}
#ifndef __WIN__
@@ -82,14 +98,14 @@
void onsignal(int signo)
{
- have_signal= true;
+ have_signal= TRUE;
}
void set_signals(sigset_t *set)
{
signal(SIGINT, onsignal);
signal(SIGTERM, onsignal);
- have_signal= false;
+ have_signal= FALSE;
}
int my_sigwait(const sigset_t *set, int *sig)
@@ -109,10 +125,15 @@
listener thread, write pid file and enter into signal handling.
See also comments in mysqlmanager.cc to picture general Instance Manager
architecture.
+
+ TODO: how about returning error status.
*/
-void manager(const Options &options)
+void manager()
{
+ int err_code;
+ const char *err_msg;
+
Thread_registry thread_registry;
/*
All objects created in the manager() function live as long as
@@ -121,26 +142,55 @@
*/
User_map user_map;
- Instance_map instance_map(options.default_mysqld_path);
+ Instance_map instance_map(Options::Main::default_mysqld_path);
Guardian_thread guardian_thread(thread_registry,
&instance_map,
- options.monitoring_interval);
+ Options::Main::monitoring_interval);
- Listener_thread_args listener_args(thread_registry, options, user_map,
- instance_map);
+ Listener_thread_args listener_args(thread_registry, user_map, instance_map);
manager_pid= getpid();
instance_map.guardian= &guardian_thread;
- if (instance_map.init() || user_map.init())
+ /* Initialize instance map. */
+
+ if (instance_map.init())
+ {
+ log_error("Error: can not initialize instance list: out of memory.");
return;
+ }
+
+ /* Initialize user map and load password file. */
- if (user_map.load(options.password_file_name))
+ if (user_map.init())
+ {
+ log_error("Error: can not initialize user list: out of memory.");
return;
+ }
+
+ if ((err_code= user_map.load(Options::Main::password_file_name, &err_msg)))
+ {
+ if (err_code == ERR_PASSWORD_FILE_DOES_NOT_EXIST &&
+ Options::Main::mysqld_safe_compatible)
+ {
+ /*
+ The password file does not exist, but we are running in
+ mysqld_safe-compatible mode. Continue, but complain in log.
+ */
+
+ log_error("Warning: password file does not exist, "
+ "nobody will be able to connect to Instance Manager.");
+ }
+ else
+ {
+ log_error("Error: %s.", (const char *) err_msg);
+ return;
+ }
+ }
/* write pid file */
- if (create_pid_file(options.pid_file_name))
- return;
+ if (create_pid_file(Options::Main::pid_file_name))
+ return; /* necessary logging has been already done. */
sigset_t mask;
set_signals(&mask);
@@ -198,7 +248,15 @@
shutdown_complete= FALSE;
- if (instance_map.flush_instances())
+ instance_map.guardian->lock();
+ instance_map.lock();
+
+ int flush_instances_status= instance_map.flush_instances();
+
+ instance_map.unlock();
+ instance_map.guardian->unlock();
+
+ if (flush_instances_status)
{
log_error("Cannot init instances repository. This might be caused by "
"the wrong config file options. For instance, missing mysqld "
@@ -240,7 +298,7 @@
{
if (!guardian_thread.is_stopped())
{
- bool stop_instances= true;
+ bool stop_instances= TRUE;
guardian_thread.request_shutdown(stop_instances);
pthread_cond_signal(&guardian_thread.COND_guardian);
}
@@ -254,7 +312,7 @@
err:
/* delete the pid file */
- my_delete(options.pid_file_name, MYF(0));
+ my_delete(Options::Main::pid_file_name, MYF(0));
#ifndef __WIN__
/* free alarm structures */
@@ -262,4 +320,3 @@
/* don't pthread_exit to kill all threads who did not shut down in time */
#endif
}
-
--- 1.4/server-tools/instance-manager/manager.h 2005-07-20 19:55:23 +04:00
+++ 1.5/server-tools/instance-manager/manager.h 2006-05-18 15:24:29 +04:00
@@ -16,8 +16,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-struct Options;
-
-void manager(const Options &options);
+void manager();
#endif // INCLUDES_MYSQL_INSTANCE_MANAGER_MANAGER_H
--- 1.16/server-tools/instance-manager/mysqlmanager.cc 2006-02-10 02:15:52 +03:00
+++ 1.17/server-tools/instance-manager/mysqlmanager.cc 2006-05-18 15:24:29 +04:00
@@ -15,25 +15,29 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
-#include "manager.h"
-
-#include "options.h"
-#include "log.h"
-
#include <my_sys.h>
+
#include <string.h>
#include <signal.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
#ifndef __WIN__
#include <pwd.h>
#include <grp.h>
#include <sys/wait.h>
#endif
-#include <sys/types.h>
-#include <sys/stat.h>
+
+#include "log.h"
+#include "manager.h"
+#include "options.h"
+#include "user_management_commands.h"
+
#ifdef __WIN__
#include "windowsservice.h"
#endif
+
/*
Few notes about Instance Manager architecture:
Instance Manager consisits of two processes: the angel process, and the
@@ -59,13 +63,12 @@
*/
static void init_environment(char *progname);
+
#ifndef __WIN__
static void daemonize(const char *log_file_name);
-static void angel(const Options &options);
+static void angel();
static struct passwd *check_user(const char *user);
static int set_user(const char *user, struct passwd *user_info);
-#else
-int HandleServiceOptions(Options options);
#endif
@@ -81,41 +84,61 @@
{
int return_value= 1;
init_environment(argv[0]);
- Options o