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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
1282838d
Commit
1282838d
authored
Oct 15, 2001
by
monty@bitch.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
Merge hundin:/my/mysql-4.0 into bitch.mysql.fi:/my/mysql-4.0
parents
b14f5e2b
da96aaed
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
116 additions
and
55 deletions
+116
-55
Build-tools/Do-compile
Build-tools/Do-compile
+1
-1
Docs/manual.texi
Docs/manual.texi
+2
-2
client/mysqlmanagerc.c
client/mysqlmanagerc.c
+2
-14
client/mysqltest.c
client/mysqltest.c
+13
-2
libmysql/manager.c
libmysql/manager.c
+16
-22
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+33
-3
mysql-test/r/rpl_failsafe.result
mysql-test/r/rpl_failsafe.result
+7
-3
mysql-test/t/rpl000018.test
mysql-test/t/rpl000018.test
+1
-0
mysql-test/t/rpl_failsafe.test
mysql-test/t/rpl_failsafe.test
+9
-0
scripts/make_binary_distribution.sh
scripts/make_binary_distribution.sh
+1
-1
sql/mysqld.cc
sql/mysqld.cc
+1
-3
sql/repl_failsafe.cc
sql/repl_failsafe.cc
+7
-0
sql/repl_failsafe.h
sql/repl_failsafe.h
+4
-1
sql/slave.cc
sql/slave.cc
+10
-1
tools/mysqlmanager.c
tools/mysqlmanager.c
+9
-2
No files found.
Build-tools/Do-compile
View file @
1282838d
...
...
@@ -215,7 +215,7 @@ if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest)
{
system
("
mkdir
$bench_tmpdir
")
if
(
!
-
d
$bench_tmpdir
);
safe_cd
("
${test_dir}
/mysql-test
");
check_system
("
./mysql-test-run --tmpdir=
$bench_tmpdir
--master_port=
$mysql_tcp_port
--slave_port=
$slave_port
--manager-port=
$manager_port
--sleep=10
",
"
tests were successful
");
check_system
("
./mysql-test-run --tmpdir=
$bench_tmpdir
--master_port=
$mysql_tcp_port
--slave_port=
$slave_port
--manager-port=
$manager_port
--
no-manager --
sleep=10
",
"
tests were successful
");
}
# Start the server if we are going to run any of the benchmarks
...
...
Docs/manual.texi
View file @
1282838d
...
...
@@ -2433,7 +2433,7 @@ mysql> SHOW STATUS;
If a bug or problem occurs while running @strong{mysqld}, try to provide an
input script that will reproduce the anomaly. This script should include any
necessary source files. The more closely the script can reproduce your
situation, the better. If you can make a rep
eat
able test case, you should
situation, the better. If you can make a rep
roduce
able test case, you should
post this to @email{bugs@@lists.mysql.com} for a high priority treatment!
If you can't provide a script, you should at least include the output
...
...
@@ -4786,7 +4786,7 @@ Included in the MySQL distribution are two different testing suites,
@file{mysql-test-run} and
@uref{http://www.mysql.com/information/crash-me.php,crash-me}, as well
as a benchmark suite. The test system is actively updated with code to
test each new feature and almost all rep
eat
able bugs that have come to
test each new feature and almost all rep
roduce
able bugs that have come to
our attention. We test MySQL with these on a lot of platforms before
every release. These tests are more sophisticated than anything we have
seen from PostgreSQL, and they ensures that the MySQL is kept to a high
client/mysqlmanagerc.c
View file @
1282838d
...
...
@@ -17,27 +17,15 @@
#define MANAGER_CLIENT_VERSION "1.0"
#include <my_global.h>
#include <my_sys.h>
#include <m_string.h>
#include <mysql.h>
#include <mysql_version.h>
#include <m_ctype.h>
#ifdef OS2
#include <config-os2.h>
#else
#include <my_config.h>
#endif
#include <my_dir.h>
#include <hash.h>
#include <mysqld_error.h>
#include <
stdio
.h>
#include <
stdlib
.h>
#include <
my_sys
.h>
#include <
m_string
.h>
#include <getopt.h>
#include <stdarg.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <violite.h>
#ifndef MYSQL_MANAGER_PORT
#define MYSQL_MANAGER_PORT 23546
...
...
client/mysqltest.c
View file @
1282838d
...
...
@@ -181,7 +181,7 @@ Q_PING, Q_EVAL,
Q_RPL_PROBE
,
Q_ENABLE_RPL_PARSE
,
Q_DISABLE_RPL_PARSE
,
Q_EVAL_RESULT
,
Q_ENABLE_QUERY_LOG
,
Q_DISABLE_QUERY_LOG
,
Q_SERVER_START
,
Q_SERVER_STOP
,
Q_SERVER_START
,
Q_SERVER_STOP
,
Q_REQUIRE_MANAGER
,
Q_UNKNOWN
,
/* Unknown command. */
Q_COMMENT
,
/* Comments, ignored. */
Q_COMMENT_WITH_COMMAND
...
...
@@ -215,6 +215,7 @@ const char *command_names[] = {
"disable_rpl_parse"
,
"eval_result"
,
"enable_query_log"
,
"disable_query_log"
,
"server_start"
,
"server_stop"
,
"require_manager"
,
0
};
...
...
@@ -640,6 +641,13 @@ int open_file(const char* name)
return
0
;
}
int
do_require_manager
(
struct
st_query
*
__attribute__
((
unused
))
q
)
{
if
(
!
manager
)
abort_not_supported_test
();
return
0
;
}
#ifndef EMBEDDED_LIBRARY
int
do_server_start
(
struct
st_query
*
q
)
{
...
...
@@ -1930,7 +1938,9 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
ds
=
&
ds_res
;
if
((
flags
&
QUERY_SEND
)
&&
mysql_send_query
(
mysql
,
query
,
query_len
))
die
(
"At line %u: unable to send query '%s'"
,
start_lineno
,
query
);
die
(
"At line %u: unable to send query '%s'(mysql_errno=%d,errno=%d)"
,
start_lineno
,
query
,
mysql_errno
(
mysql
),
errno
);
if
((
flags
&
QUERY_SEND
)
&&
!
disable_query_log
)
{
dynstr_append_mem
(
ds
,
query
,
query_len
);
...
...
@@ -2236,6 +2246,7 @@ int main(int argc, char** argv)
case
Q_DISABLE_QUERY_LOG
:
disable_query_log
=
1
;
break
;
case
Q_SOURCE
:
do_source
(
q
);
break
;
case
Q_SLEEP
:
do_sleep
(
q
);
break
;
case
Q_REQUIRE_MANAGER
:
do_require_manager
(
q
);
break
;
#ifndef EMBEDDED_LIBRARY
case
Q_SERVER_START
:
do_server_start
(
q
);
break
;
case
Q_SERVER_STOP
:
do_server_stop
(
q
);
break
;
...
...
libmysql/manager.c
View file @
1282838d
...
...
@@ -16,31 +16,30 @@
MA 02111-1307, USA */
#include <my_global.h>
#if defined(__WIN__) || defined(_WIN32) || defined(_WIN64)
#include <winsock.h>
#include <odbcinst.h>
#if defined(THREAD)
#include <my_pthread.h>
/* because of signal() */
#endif
#include "mysql.h"
#include "mysql_version.h"
#include "mysqld_error.h"
#include <my_sys.h>
#include <mysys_err.h>
#include <m_string.h>
#include <m_ctype.h>
#include "mysql.h"
#include "mysql_version.h"
#include "mysqld_error.h"
#include "errmsg.h"
#include <my_net.h>
#include <errmsg.h>
#include <violite.h>
#include <sys/stat.h>
#include <signal.h>
#include <time.h>
#include <errno.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
#if defined(OS2)
# include <sys/un.h>
#elif !defined( __WIN__)
#include <sys/resource.h>
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
#if !defined(MSDOS) && !defined(__WIN__)
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#ifdef HAVE_SELECT_H
# include <select.h>
...
...
@@ -48,18 +47,13 @@
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#endif
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
#if defined(THREAD) && !defined(__WIN__)
#include <my_pthread.h>
/* because of signal() */
#endif
#include <sys/utsname.h>
#endif
/* __WIN__ */
#ifndef INADDR_NONE
#define INADDR_NONE -1
#endif
#define RES_BUF_SHIFT 5
#define SOCKET_ERROR -1
#define NET_BUF_SIZE 2048
...
...
mysql-test/mysql-test-run.sh
View file @
1282838d
...
...
@@ -12,6 +12,7 @@
DB
=
test
DBPASSWD
=
VERBOSE
=
""
USE_MANAGER
=
0
TZ
=
GMT-3
;
export
TZ
# for UNIX_TIMESTAMP tests to work
#++
...
...
@@ -162,6 +163,8 @@ while test $# -gt 0; do
--ssl-ca=
$BASEDIR
/SSL/cacert.pem
\
--ssl-cert=
$BASEDIR
/SSL/server-cert.pem
\
--ssl-key=
$BASEDIR
/SSL/server-key.pem"
;;
--no-manager
|
--skip-manager
)
USE_MANAGER
=
0
;;
--manager
)
USE_MANAGER
=
1
;;
--skip-innobase
)
EXTRA_MASTER_MYSQLD_OPT
=
"
$EXTRA_MASTER_MYSQLD_OPT
--skip-innobase"
EXTRA_SLAVE_MYSQLD_OPT
=
"
$EXTRA_SLAVE_MYSQLD_OPT
--skip-innobase"
;;
...
...
@@ -476,6 +479,7 @@ mysql_install_db () {
for
slave_num
in
1 2
;
do
rm
-rf
var/slave
$slave_num
-data
/
mkdir
-p
var/slave
$slave_num
-data
/mysql
mkdir
-p
var/slave
$slave_num
-data
/test
cp
var/slave-data/mysql/
*
var/slave
$slave_num
-data
/mysql
...
...
@@ -533,6 +537,12 @@ abort_if_failed()
start_manager
()
{
if
[
$USE_MANAGER
=
0
]
;
then
echo
"Manager disabled, skipping manager start. Tests requiring manager will
\
be skipped"
return
fi
$ECHO
"Starting MySQL Manager"
MYSQL_MANAGER_PW
=
`
$MYSQL_MANAGER_PWGEN
-u
$MYSQL_MANAGER_USER
\
-o
$MYSQL_MANAGER_PW_FILE
`
$MYSQL_MANAGER
--log
=
$MYSQL_MANAGER_LOG
--port
=
$MYSQL_MANAGER_PORT
\
...
...
@@ -550,6 +560,9 @@ start_manager()
stop_manager
()
{
if
[
$USE_MANAGER
=
0
]
;
then
return
fi
$MYSQL_MANAGER_CLIENT
$MANAGER_QUIET_OPT
-u
$MYSQL_MANAGER_USER
\
-p
$MYSQL_MANAGER_PW
-P
$MYSQL_MANAGER_PORT
<<
EOF
shutdown
...
...
@@ -560,6 +573,11 @@ manager_launch()
{
ident
=
$1
shift
if
[
$USE_MANAGER
=
0
]
;
then
$@
>
$CUR_MYERR
2>&1 &
sleep
2
#hack
return
fi
$MYSQL_MANAGER_CLIENT
$MANAGER_QUIET_OPT
--user
=
$MYSQL_MANAGER_USER
\
--password
=
$MYSQL_MANAGER_PW
--port
=
$MYSQL_MANAGER_PORT
<<
EOF
def_exec
$ident
$@
...
...
@@ -575,6 +593,11 @@ manager_term()
{
ident
=
$1
shift
if
[
$USE_MANAGER
=
0
]
;
then
$MYSQLADMIN
--no-defaults
-uroot
--socket
=
$MYSQL_TMP_DIR
/
$ident
.sock
-O
\
connect_timeout
=
5 shutdown
>
/dev/null 2>&1
return
fi
$MYSQL_MANAGER_CLIENT
$MANAGER_QUIET_OPT
--user
=
$MYSQL_MANAGER_USER
\
--password
=
$MYSQL_MANAGER_PW
--port
=
$MYSQL_MANAGER_PORT
<<
EOF
stop_exec
$ident
$STOP_WAIT_TIMEOUT
...
...
@@ -841,7 +864,10 @@ run_testcase ()
slave_init_script
=
$TESTDIR
/
$tname
-slave
.sh
slave_master_info_file
=
$TESTDIR
/
$tname
-slave-master-info
.opt
SKIP_SLAVE
=
`
$EXPR
\(
$tname
: rpl
\)
=
0
`
if
[
$USE_MANAGER
=
1
]
;
then
many_slaves
=
`
$EXPR
\(
$tname
: rpl_failsafe
\)
!=
0
`
fi
if
[
-n
"
$SKIP_TEST
"
]
;
then
SKIP_THIS_TEST
=
`
$EXPR
\(
$tname
:
"
$SKIP_TEST
"
\)
!=
0
`
if
[
x
$SKIP_THIS_TEST
=
x1
]
;
...
...
@@ -953,6 +979,11 @@ run_testcase ()
pname
=
`
$ECHO
"
$tname
"
|
$CUT
-c
1-24
`
RES
=
"
$pname
$timestr
"
if
[
x
$many_slaves
=
x1
]
;
then
stop_slave 1
stop_slave 2
fi
if
[
$res
=
0
]
;
then
total_inc
pass_inc
...
...
@@ -1009,7 +1040,6 @@ then
$MYSQLADMIN
--no-defaults
--socket
=
$SLAVE_MYSOCK
-u
root
-O
connect_timeout
=
5 shutdown
>
/dev/null 2>&1
$ECHO
"Installing Test Databases"
mysql_install_db
$ECHO
"Starting MySQL Manager"
start_manager
#do not automagically start deamons if we are in gdb or running only one test
#case
...
...
mysql-test/r/rpl_failsafe.result
View file @
1282838d
...
...
@@ -9,21 +9,25 @@ rpl_recovery_rank 1
show status like 'Rpl_status';
Variable_name Value
Rpl_status AUTH_MASTER
create table t1(n int);
drop table t1;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 2
show status like 'Rpl_status';
Variable_name Value
Rpl_status IDLE_SLAVE
Rpl_status ACTIVE_SLAVE
slave start;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 3
show status like 'Rpl_status';
Variable_name Value
Rpl_status IDLE_SLAVE
Rpl_status ACTIVE_SLAVE
slave start;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 4
show status like 'Rpl_status';
Variable_name Value
Rpl_status
IDL
E_SLAVE
Rpl_status
ACTIV
E_SLAVE
mysql-test/t/rpl000018.test
View file @
1282838d
require_manager
;
connect
(
master
,
localhost
,
root
,,
test
,
0
,
master
.
sock
);
connect
(
slave
,
localhost
,
root
,,
test
,
0
,
slave
.
sock
);
server_stop
master
;
...
...
mysql-test/t/rpl_failsafe.test
View file @
1282838d
require_manager
;
source
include
/
master
-
slave
.
inc
;
connect
(
slave_sec
,
localhost
,
root
,,
test
,
0
,
slave
.
sock
-
1
);
connect
(
slave_ter
,
localhost
,
root
,,
test
,
0
,
slave
.
sock
-
2
);
connection
master
;
show
variables
like
'rpl_recovery_rank'
;
show
status
like
'Rpl_status'
;
create
table
t1
(
n
int
);
drop
table
t1
;
save_master_pos
;
connection
slave
;
sync_with_master
;
show
variables
like
'rpl_recovery_rank'
;
show
status
like
'Rpl_status'
;
connection
slave_sec
;
slave
start
;
sync_with_master
;
show
variables
like
'rpl_recovery_rank'
;
show
status
like
'Rpl_status'
;
connection
slave_ter
;
slave
start
;
sync_with_master
;
show
variables
like
'rpl_recovery_rank'
;
show
status
like
'Rpl_status'
;
scripts/make_binary_distribution.sh
View file @
1282838d
...
...
@@ -70,7 +70,7 @@ for i in extra/comp_err extra/replace extra/perror extra/resolveip \
client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin
\
client/.libs/mysqldump client/.libs/mysqlimport client/.libs/mysqltest
\
client/.libs/mysqlcheck
\
client/.libs/mysqlmanagerc client/libs/mysqlmanager-pwgen
\
client/.libs/mysqlmanagerc client/
.
libs/mysqlmanager-pwgen
\
tools/.libs/mysqlmanager
do
if
[
-f
$i
]
...
...
sql/mysqld.cc
View file @
1282838d
...
...
@@ -77,9 +77,7 @@ extern "C" { // Because of SCO 3.2V4.2
#include <sys/select.h>
#endif
#include <sys/utsname.h>
#else
#include <windows.h>
#endif // __WIN__
#endif
/* __WIN__ */
#ifdef HAVE_LIBWRAP
#include <tcpd.h>
...
...
sql/repl_failsafe.cc
View file @
1282838d
...
...
@@ -33,4 +33,11 @@ const char* rpl_status_type[] = {"AUTH_MASTER","ACTIVE_SLAVE","IDLE_SLAVE",
TYPELIB
rpl_status_typelib
=
{
array_elements
(
rpl_status_type
)
-
1
,
""
,
rpl_status_type
};
void
change_rpl_status
(
RPL_STATUS
from_status
,
RPL_STATUS
to_status
)
{
pthread_mutex_lock
(
&
LOCK_rpl_status
);
if
(
rpl_status
==
from_status
||
rpl_status
==
RPL_ANY
)
rpl_status
=
to_status
;
pthread_mutex_unlock
(
&
LOCK_rpl_status
);
}
sql/repl_failsafe.h
View file @
1282838d
...
...
@@ -3,11 +3,14 @@
typedef
enum
{
RPL_AUTH_MASTER
=
0
,
RPL_ACTIVE_SLAVE
,
RPL_IDLE_SLAVE
,
RPL_LOST_SOLDIER
,
RPL_TROOP_SOLDIER
,
RPL_RECOVERY_CAPTAIN
,
RPL_NULL
}
RPL_STATUS
;
RPL_RECOVERY_CAPTAIN
,
RPL_NULL
/* inactive */
,
RPL_ANY
/* wild card used by change_rpl_status */
}
RPL_STATUS
;
extern
RPL_STATUS
rpl_status
;
extern
pthread_mutex_t
LOCK_rpl_status
;
extern
pthread_cond_t
COND_rpl_status
;
extern
TYPELIB
rpl_role_typelib
,
rpl_status_typelib
;
extern
const
char
*
rpl_role_type
[],
*
rpl_status_type
[];
void
change_rpl_status
(
RPL_STATUS
from_status
,
RPL_STATUS
to_status
);
#endif
sql/slave.cc
View file @
1282838d
...
...
@@ -21,6 +21,7 @@
#include "mini_client.h"
#include "slave.h"
#include "sql_repl.h"
#include "repl_failsafe.h"
#include <thr_alarm.h>
#include <my_dir.h>
...
...
@@ -1220,6 +1221,7 @@ position %s",
thd
->
proc_info
=
"Waiting for slave mutex on exit"
;
pthread_mutex_lock
(
&
LOCK_slave
);
slave_running
=
0
;
change_rpl_status
(
RPL_ACTIVE_SLAVE
,
RPL_IDLE_SLAVE
);
abort_slave
=
0
;
save_temporary_tables
=
thd
->
temporary_tables
;
thd
->
temporary_tables
=
0
;
// remove tempation from destructor to close them
...
...
@@ -1257,6 +1259,7 @@ static int safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi)
if
(
!
slave_was_killed
)
{
change_rpl_status
(
RPL_IDLE_SLAVE
,
RPL_ACTIVE_SLAVE
);
mysql_log
.
write
(
thd
,
COM_CONNECT_OUT
,
"%s@%s:%d"
,
mi
->
user
,
mi
->
host
,
mi
->
port
);
#ifdef SIGNAL_WITH_VIO_CLOSE
...
...
@@ -1298,9 +1301,15 @@ static int safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi)
mi
->
connect_retry
);
safe_sleep
(
thd
,
mi
->
connect_retry
);
}
if
(
err_count
++
==
master_retry_count
)
/* by default we try forever. The reason is that failure will trigger
master election, so if the user did not set master_retry_count we
do not want to have electioin triggered on the first failure to
connect
*/
if
(
master_retry_count
&&
err_count
++
==
master_retry_count
)
{
slave_was_killed
=
1
;
change_rpl_status
(
RPL_ACTIVE_SLAVE
,
RPL_LOST_SOLDIER
);
break
;
}
}
...
...
tools/mysqlmanager.c
View file @
1282838d
...
...
@@ -88,6 +88,8 @@
#define MAX_LAUNCHER_MSG 256
#endif
#define MAX_RETRY_COUNT 100
/* Variable naming convention - if starts with manager_, either is set
directly by the user, or used closely in ocnjunction with a variable
set by the user
...
...
@@ -1161,10 +1163,15 @@ static char* read_line(struct manager_thd* thd)
{
int
len
,
read_len
;
char
*
block_end
,
*
p_back
;
uint
retry_count
=
0
;
read_len
=
min
(
NET_BLOCK
,(
uint
)(
buf_end
-
p
));
if
((
len
=
vio_read
(
thd
->
vio
,
p
,
read_len
))
<=
0
)
while
((
len
=
vio_read
(
thd
->
vio
,
p
,
read_len
))
<=
0
)
{
log_err
(
"Error reading command from client"
);
if
(
vio_should_retry
(
thd
->
vio
)
&&
retry_count
++
<
MAX_RETRY_COUNT
)
continue
;
log_err
(
"Error reading command from client (Error: %d)"
,
vio_errno
(
thd
->
vio
));
thd
->
fatal
=
1
;
return
0
;
}
...
...
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