Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
fe87e347
Commit
fe87e347
authored
Feb 10, 2006
by
petr@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/cps/mysql/devel/5.0-mike
parents
9ea857d0
f037d477
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
63 additions
and
16 deletions
+63
-16
mysql-test/r/im_life_cycle.result
mysql-test/r/im_life_cycle.result
+2
-0
mysql-test/t/im_life_cycle.imtest
mysql-test/t/im_life_cycle.imtest
+9
-0
server-tools/instance-manager/Makefile.am
server-tools/instance-manager/Makefile.am
+2
-4
server-tools/instance-manager/commands.cc
server-tools/instance-manager/commands.cc
+1
-1
server-tools/instance-manager/instance.cc
server-tools/instance-manager/instance.cc
+4
-0
server-tools/instance-manager/instance_map.cc
server-tools/instance-manager/instance_map.cc
+24
-2
server-tools/instance-manager/mysqlmanager.cc
server-tools/instance-manager/mysqlmanager.cc
+2
-1
server-tools/instance-manager/options.cc
server-tools/instance-manager/options.cc
+4
-1
server-tools/instance-manager/options.h
server-tools/instance-manager/options.h
+1
-0
server-tools/instance-manager/parse.cc
server-tools/instance-manager/parse.cc
+6
-4
server-tools/instance-manager/portability.h
server-tools/instance-manager/portability.h
+1
-2
server-tools/instance-manager/priv.cc
server-tools/instance-manager/priv.cc
+2
-1
server-tools/instance-manager/priv.h
server-tools/instance-manager/priv.h
+5
-0
No files found.
mysql-test/r/im_life_cycle.result
View file @
fe87e347
...
@@ -62,3 +62,5 @@ SHOW INSTANCES;
...
@@ -62,3 +62,5 @@ SHOW INSTANCES;
instance_name status
instance_name status
mysqld1 online
mysqld1 online
mysqld2 offline
mysqld2 offline
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
mysql-test/t/im_life_cycle.imtest
View file @
fe87e347
...
@@ -140,3 +140,12 @@ SHOW INSTANCES;
...
@@ -140,3 +140,12 @@ SHOW INSTANCES;
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed
SHOW INSTANCES;
SHOW INSTANCES;
###########################################################################
#
# 1.1.8. Check that Instance Manager returns an error on
# incomplete SHOW INSTANCE STATUS command.
#
###########################################################################
--error 1149
SHOW INSTANCE STATUS;
server-tools/instance-manager/Makefile.am
View file @
fe87e347
...
@@ -30,11 +30,9 @@ liboptions_a_CXXFLAGS= $(CXXFLAGS) \
...
@@ -30,11 +30,9 @@ liboptions_a_CXXFLAGS= $(CXXFLAGS) \
-DDEFAULT_PID_FILE_NAME
=
"
$(localstatedir)
/mysqlmanager.pid"
\
-DDEFAULT_PID_FILE_NAME
=
"
$(localstatedir)
/mysqlmanager.pid"
\
-DDEFAULT_LOG_FILE_NAME
=
"
$(localstatedir)
/mysqlmanager.log"
\
-DDEFAULT_LOG_FILE_NAME
=
"
$(localstatedir)
/mysqlmanager.log"
\
-DDEFAULT_SOCKET_FILE_NAME
=
"/tmp/mysqlmanager.sock"
\
-DDEFAULT_SOCKET_FILE_NAME
=
"/tmp/mysqlmanager.sock"
\
-DDEFAULT_PASSWORD_FILE_NAME
=
"
$(sysconfdir)
/mysqlmanager.passwd"
\
-DDEFAULT_PASSWORD_FILE_NAME
=
"
/etc
/mysqlmanager.passwd"
\
-DDEFAULT_MYSQLD_PATH
=
"
$(libexecdir)
/mysqld
$(EXEEXT)
"
\
-DDEFAULT_MYSQLD_PATH
=
"
$(libexecdir)
/mysqld
$(EXEEXT)
"
\
-DDEFAULT_MONITORING_INTERVAL
=
"20"
\
-DDEFAULT_CONFIG_FILE
=
"/etc/my.cnf"
\
-DDEFAULT_PORT
=
"2273"
\
-DDEFAULT_CONFIG_FILE
=
"/etc/my.cnf"
\
-DPROTOCOL_VERSION
=
@PROTOCOL_VERSION@
-DPROTOCOL_VERSION
=
@PROTOCOL_VERSION@
liboptions_a_SOURCES
=
options.h options.cc priv.h priv.cc
liboptions_a_SOURCES
=
options.h options.cc priv.h priv.cc
...
...
server-tools/instance-manager/commands.cc
View file @
fe87e347
...
@@ -483,7 +483,7 @@ int Show_instance_log::execute(struct st_net *net, ulong connection_id)
...
@@ -483,7 +483,7 @@ int Show_instance_log::execute(struct st_net *net, ulong connection_id)
read_buff
.
reserve
(
0
,
buff_size
);
read_buff
.
reserve
(
0
,
buff_size
);
/* read in one chunk */
/* read in one chunk */
read_len
=
my_seek
(
fd
,
file_stat
.
st_size
-
size
,
MY_SEEK_SET
,
MYF
(
0
));
read_len
=
(
int
)
my_seek
(
fd
,
file_stat
.
st_size
-
size
,
MY_SEEK_SET
,
MYF
(
0
));
if
((
read_len
=
my_read
(
fd
,
(
byte
*
)
read_buff
.
buffer
,
if
((
read_len
=
my_read
(
fd
,
(
byte
*
)
read_buff
.
buffer
,
buff_size
,
MYF
(
0
)))
<
0
)
buff_size
,
MYF
(
0
)))
<
0
)
...
...
server-tools/instance-manager/instance.cc
View file @
fe87e347
...
@@ -418,6 +418,10 @@ bool Instance::is_running()
...
@@ -418,6 +418,10 @@ bool Instance::is_running()
if
(
options
.
mysqld_socket
)
if
(
options
.
mysqld_socket
)
socket
=
strchr
(
options
.
mysqld_socket
,
'='
)
+
1
;
socket
=
strchr
(
options
.
mysqld_socket
,
'='
)
+
1
;
/* no port was specified => instance falled back to default value */
if
(
!
options
.
mysqld_port
&&
!
options
.
mysqld_socket
)
port
=
SERVER_DEFAULT_PORT
;
pthread_mutex_lock
(
&
LOCK_instance
);
pthread_mutex_lock
(
&
LOCK_instance
);
mysql_init
(
&
mysql
);
mysql_init
(
&
mysql
);
...
...
server-tools/instance-manager/instance_map.cc
View file @
fe87e347
...
@@ -229,11 +229,33 @@ int Instance_map::load()
...
@@ -229,11 +229,33 @@ int Instance_map::load()
uint
args_used
=
0
;
uint
args_used
=
0
;
const
char
*
argv_options
[
3
];
const
char
*
argv_options
[
3
];
char
**
argv
=
(
char
**
)
&
argv_options
;
char
**
argv
=
(
char
**
)
&
argv_options
;
char
defaults_file_arg
[
FN_REFLEN
];
/* the name of the program may be orbitrary here in fact */
/* the name of the program may be orbitrary here in fact */
argv_options
[
0
]
=
"mysqlmanager"
;
argv_options
[
0
]
=
"mysqlmanager"
;
argv_options
[
1
]
=
'\0'
;
/*
If the option file was forced by the user when starting
the IM with --defaults-file=xxxx, make sure it is also
passed as --defaults-file, not only as Options::config_file.
This is important for option files given with relative path:
e.g. --defaults-file=my.cnf.
Otherwise my_search_option_files will treat "my.cnf" as a group
name and start looking for files named "my.cnf.cnf" in all
default dirs. Which is not what we want.
*/
if
(
Options
::
is_forced_default_file
)
{
snprintf
(
defaults_file_arg
,
FN_REFLEN
,
"--defaults-file=%s"
,
Options
::
config_file
);
argv_options
[
1
]
=
defaults_file_arg
;
argv_options
[
2
]
=
'\0'
;
argc
=
2
;
}
else
argv_options
[
1
]
=
'\0'
;
/*
/*
If the routine failed, we'll simply fallback to defaults in
If the routine failed, we'll simply fallback to defaults in
...
...
server-tools/instance-manager/mysqlmanager.cc
View file @
fe87e347
...
@@ -82,12 +82,13 @@ int main(int argc, char *argv[])
...
@@ -82,12 +82,13 @@ int main(int argc, char *argv[])
int
return_value
=
1
;
int
return_value
=
1
;
init_environment
(
argv
[
0
]);
init_environment
(
argv
[
0
]);
Options
options
;
Options
options
;
struct
passwd
*
user_info
;
if
(
options
.
load
(
argc
,
argv
))
if
(
options
.
load
(
argc
,
argv
))
goto
err
;
goto
err
;
#ifndef __WIN__
#ifndef __WIN__
struct
passwd
*
user_info
;
if
((
user_info
=
check_user
(
options
.
user
)))
if
((
user_info
=
check_user
(
options
.
user
)))
{
{
if
(
set_user
(
options
.
user
,
user_info
))
if
(
set_user
(
options
.
user
,
user_info
))
...
...
server-tools/instance-manager/options.cc
View file @
fe87e347
...
@@ -55,6 +55,8 @@ uint Options::monitoring_interval= DEFAULT_MONITORING_INTERVAL;
...
@@ -55,6 +55,8 @@ uint Options::monitoring_interval= DEFAULT_MONITORING_INTERVAL;
uint
Options
::
port_number
=
DEFAULT_PORT
;
uint
Options
::
port_number
=
DEFAULT_PORT
;
/* just to declare */
/* just to declare */
char
**
Options
::
saved_argv
=
NULL
;
char
**
Options
::
saved_argv
=
NULL
;
/* Remember if the config file was forced */
bool
Options
::
is_forced_default_file
=
0
;
/*
/*
List of options, accepted by the instance manager.
List of options, accepted by the instance manager.
...
@@ -118,7 +120,7 @@ static struct my_option my_long_options[] =
...
@@ -118,7 +120,7 @@ static struct my_option my_long_options[] =
" Server binary."
,
" Server binary."
,
(
gptr
*
)
&
Options
::
default_mysqld_path
,
(
gptr
*
)
&
Options
::
default_mysqld_path
,
(
gptr
*
)
&
Options
::
default_mysqld_path
,
(
gptr
*
)
&
Options
::
default_mysqld_path
,
0
,
GET_STR
,
REQUIRED
_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
0
,
GET_STR
,
OPT
_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"monitoring-interval"
,
OPT_MONITORING_INTERVAL
,
"Interval to monitor"
{
"monitoring-interval"
,
OPT_MONITORING_INTERVAL
,
"Interval to monitor"
" instances in seconds."
,
" instances in seconds."
,
...
@@ -254,6 +256,7 @@ int Options::load(int argc, char **argv)
...
@@ -254,6 +256,7 @@ int Options::load(int argc, char **argv)
if
(
is_prefix
(
argv
[
1
],
"--defaults-file="
))
if
(
is_prefix
(
argv
[
1
],
"--defaults-file="
))
{
{
Options
::
config_file
=
strchr
(
argv
[
1
],
'='
)
+
1
;
Options
::
config_file
=
strchr
(
argv
[
1
],
'='
)
+
1
;
Options
::
is_forced_default_file
=
1
;
}
}
if
(
is_prefix
(
argv
[
1
],
"--defaults-extra-file="
)
||
if
(
is_prefix
(
argv
[
1
],
"--defaults-extra-file="
)
||
is_prefix
(
argv
[
1
],
"--no-defaults"
))
is_prefix
(
argv
[
1
],
"--no-defaults"
))
...
...
server-tools/instance-manager/options.h
View file @
fe87e347
...
@@ -36,6 +36,7 @@ struct Options
...
@@ -36,6 +36,7 @@ struct Options
static
char
run_as_service
;
/* handle_options doesn't support bool */
static
char
run_as_service
;
/* handle_options doesn't support bool */
static
const
char
*
user
;
static
const
char
*
user
;
#endif
#endif
static
bool
is_forced_default_file
;
static
const
char
*
log_file_name
;
static
const
char
*
log_file_name
;
static
const
char
*
pid_file_name
;
static
const
char
*
pid_file_name
;
static
const
char
*
socket_file_name
;
static
const
char
*
socket_file_name
;
...
...
server-tools/instance-manager/parse.cc
View file @
fe87e347
...
@@ -166,7 +166,8 @@ Command *parse_command(Instance_map *map, const char *text)
...
@@ -166,7 +166,8 @@ Command *parse_command(Instance_map *map, const char *text)
skip
=
true
;
skip
=
true
;
case
TOK_SET
:
case
TOK_SET
:
get_text_id
(
&
text
,
&
instance_name_len
,
&
instance_name
);
if
(
get_text_id
(
&
text
,
&
instance_name_len
,
&
instance_name
))
goto
syntax_error
;
text
+=
instance_name_len
;
text
+=
instance_name_len
;
/* the next token should be a dot */
/* the next token should be a dot */
...
@@ -221,7 +222,8 @@ Command *parse_command(Instance_map *map, const char *text)
...
@@ -221,7 +222,8 @@ Command *parse_command(Instance_map *map, const char *text)
switch
(
Token
tok2
=
shift_token
(
&
text
,
&
word_len
))
{
switch
(
Token
tok2
=
shift_token
(
&
text
,
&
word_len
))
{
case
TOK_OPTIONS
:
case
TOK_OPTIONS
:
case
TOK_STATUS
:
case
TOK_STATUS
:
get_text_id
(
&
text
,
&
instance_name_len
,
&
instance_name
);
if
(
get_text_id
(
&
text
,
&
instance_name_len
,
&
instance_name
))
goto
syntax_error
;
text
+=
instance_name_len
;
text
+=
instance_name_len
;
/* check that this is the end of the command */
/* check that this is the end of the command */
get_word
(
&
text
,
&
word_len
);
get_word
(
&
text
,
&
word_len
);
...
@@ -273,7 +275,8 @@ Command *parse_command(Instance_map *map, const char *text)
...
@@ -273,7 +275,8 @@ Command *parse_command(Instance_map *map, const char *text)
goto
syntax_error
;
goto
syntax_error
;
}
}
/* get the size of the log we want to retrieve */
/* get the size of the log we want to retrieve */
get_text_id
(
&
text
,
&
word_len
,
&
log_size
);
if
(
get_text_id
(
&
text
,
&
word_len
,
&
log_size
))
goto
syntax_error
;
text
+=
word_len
;
text
+=
word_len
;
/* this parameter is required */
/* this parameter is required */
if
(
!
word_len
)
if
(
!
word_len
)
...
@@ -291,7 +294,6 @@ Command *parse_command(Instance_map *map, const char *text)
...
@@ -291,7 +294,6 @@ Command *parse_command(Instance_map *map, const char *text)
instance_name_len
,
log_type
,
instance_name_len
,
log_type
,
log_size
,
text
);
log_size
,
text
);
//get_text_id(&text, &log_size_len, &log_size);
break
;
break
;
case
'\0'
:
case
'\0'
:
command
=
new
Show_instance_log
(
map
,
instance_name
,
command
=
new
Show_instance_log
(
map
,
instance_name
,
...
...
server-tools/instance-manager/portability.h
View file @
fe87e347
...
@@ -8,13 +8,12 @@
...
@@ -8,13 +8,12 @@
#ifdef __WIN__
#ifdef __WIN__
#define vsnprintf _vsnprintf
#define vsnprintf _vsnprintf
#define snprintf _snprintf
#define SIGKILL 9
#define SIGKILL 9
#define SHUT_RDWR 0x2
#define SHUT_RDWR 0x2
/*TODO: fix this */
/*TODO: fix this */
#define DEFAULT_MONITORING_INTERVAL 20
#define DEFAULT_PORT 2273
#define PROTOCOL_VERSION 10
#define PROTOCOL_VERSION 10
typedef
int
pid_t
;
typedef
int
pid_t
;
...
...
server-tools/instance-manager/priv.cc
View file @
fe87e347
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#include <my_global.h>
#include <mysql_com.h>
#include "priv.h"
#include "priv.h"
#include "portability.h"
#include "portability.h"
...
@@ -52,7 +53,7 @@ unsigned long net_buffer_length= 16384;
...
@@ -52,7 +53,7 @@ unsigned long net_buffer_length= 16384;
unsigned
long
max_allowed_packet
=
16384
;
unsigned
long
max_allowed_packet
=
16384
;
unsigned
long
net_read_timeout
=
30
;
// same as in mysqld
unsigned
long
net_read_timeout
=
NET_WAIT_TIMEOUT
;
// same as in mysqld
unsigned
long
net_write_timeout
=
60
;
// same as in mysqld
unsigned
long
net_write_timeout
=
60
;
// same as in mysqld
...
...
server-tools/instance-manager/priv.h
View file @
fe87e347
...
@@ -24,6 +24,11 @@
...
@@ -24,6 +24,11 @@
#endif
#endif
#include "my_pthread.h"
#include "my_pthread.h"
/* IM-wide platform-independent defines */
#define SERVER_DEFAULT_PORT 3306
#define DEFAULT_MONITORING_INTERVAL 20
#define DEFAULT_PORT 2273
/* the pid of the manager process (of the signal thread on the LinuxThreads) */
/* the pid of the manager process (of the signal thread on the LinuxThreads) */
extern
pid_t
manager_pid
;
extern
pid_t
manager_pid
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment