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
05bbf3ef
Commit
05bbf3ef
authored
Jan 07, 2003
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/my/mysql-4.0 into mashka.mysql.fi:/home/my/mysql-4.0
parents
db060cb7
b3b66f64
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
233 additions
and
129 deletions
+233
-129
Build-tools/Do-compile
Build-tools/Do-compile
+17
-10
client/mysqladmin.c
client/mysqladmin.c
+40
-22
client/mysqltest.c
client/mysqltest.c
+4
-4
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+22
-11
sql-bench/bench-init.pl.sh
sql-bench/bench-init.pl.sh
+4
-1
sql-bench/crash-me.sh
sql-bench/crash-me.sh
+72
-54
sql-bench/test-alter-table.sh
sql-bench/test-alter-table.sh
+37
-6
sql-bench/test-insert.sh
sql-bench/test-insert.sh
+4
-3
sql/mysql_priv.h
sql/mysql_priv.h
+0
-1
sql/mysqld.cc
sql/mysqld.cc
+27
-16
sql/net_pkg.cc
sql/net_pkg.cc
+4
-1
sql/slave.cc
sql/slave.cc
+2
-0
No files found.
Build-tools/Do-compile
View file @
05bbf3ef
...
...
@@ -135,6 +135,7 @@ $ENV{'MYSQL_UNIX_PORT'}=$mysql_unix_port="$opt_tmp/mysql$opt_suffix.build";
$ENV
{"
PERL5LIB
"}
=
"
$pwd
/
$host
/perl5:
$pwd
/
$host
/perl5/site_perl
";
$slave_port
=
$mysql_tcp_port
+
16
;
$manager_port
=
$mysql_tcp_port
+
1
;
$mysqladmin_args
=
"
--no-defaults -u root --connect_timeout=5 --shutdown_timeout=20
";
if
(
$opt_stage
==
0
)
{
...
...
@@ -154,13 +155,18 @@ log_timestamp();
if
(
-
x
"
$host
/bin/mysqladmin
")
{
log_system
("
$host
/bin/mysqladmin
--no-defaults -u root
-S
$mysql_unix_port
-s shutdown
");
log_system
("
$host
/bin/mysqladmin
--no-defaults -u root
-P
$mysql_tcp_port
-h
$host
-s shutdown
");
log_system
("
$host
/bin/mysqladmin
--no-defaults -u root
-P
$slave_port
-h
$host
-s shutdown
");
log_system
("
$host
/bin/mysqladmin
--no-defaults -u root
-P 9306 -h
$host
-s shutdown
");
log_system
("
$host
/bin/mysqladmin
--no-defaults -u root
-P 9307 -h
$host
-s shutdown
");
log_system
("
$host
/bin/mysqladmin
$mysqladmin_args
-S
$mysql_unix_port
-s shutdown
");
log_system
("
$host
/bin/mysqladmin
$mysqladmin_args
-P
$mysql_tcp_port
-h
$host
-s shutdown
");
log_system
("
$host
/bin/mysqladmin
$mysqladmin_args
-P
$slave_port
-h
$host
-s shutdown
");
log_system
("
$host
/bin/mysqladmin
$mysqladmin_args
-P 9306 -h
$host
-s shutdown
");
log_system
("
$host
/bin/mysqladmin
$mysqladmin_args
-P 9307 -h
$host
-s shutdown
");
}
kill_all
("
mysqlmanager
");
#
# Kill all old processes that are in the build directories
# This is to find any old mysqld servers left from previous builds
kill_all
("
$pwd
/host/mysql
");
kill_all
("
$pwd
/host/test
");
if
(
$opt_stage
==
0
)
{
...
...
@@ -308,8 +314,9 @@ if ($opt_stage <= 4 && !$opt_no_test)
$tar_file
=~
/(mysql[^\/]*)\.tar/
;
$ver
=
$1
;
$test_dir
=
"
$pwd
/
$host
/test/
$ver
";
$ENV
{"
LD_LIBRARY_PATH
"}
=
"
$test_dir
/lib:
"
.
$ENV
{"
LD_LIBRARY_PATH
"};
$ENV
{"
LD_LIBRARY_PATH
"}
=
("
$test_dir
/lib
"
.
(
defined
(
$ENV
{"
LD_LIBRARY_PATH
"})
?
"
:
"
.
$ENV
{"
LD_LIBRARY_PATH
"}
:
""));
#
# Run the test suite
#
...
...
@@ -328,7 +335,7 @@ if (!$opt_no_test && !$opt_no_benchmark)
{
my
$extra
;
safe_cd
(
$test_dir
);
log_system
("
./bin/mysqladmin
--no-defaults -u root
-S
$mysql_unix_port
-s shutdown
")
||
info
("
There was no mysqld running
\n
");
log_system
("
./bin/mysqladmin
$mysqladmin_args
-S
$mysql_unix_port
-s shutdown
")
||
info
("
There was no mysqld running
\n
");
sleep
(
2
);
log_system
("
rm -f ./data/mysql/*
");
check_system
("
scripts/mysql_install_db --no-defaults --skip-locking
","
https://order
");
...
...
@@ -418,7 +425,7 @@ if ($opt_stage <= 9 && !$opt_no_test && !$opt_no_benchmark)
rm_all
(
$bench_tmpdir
);
rm_all
("
$opt_tmp
")
if
(
$new_opt_tmp
);
log_system
("
$pwd
/
$host
/bin/mysqladmin
--no-default
s -S
$mysql_unix_port
-u root shutdown
");
log_system
("
$pwd
/
$host
/bin/mysqladmin
$mysqladmin_arg
s
-S
$mysql_unix_port
-u root shutdown
");
print
LOG
"
ok
\n
";
close
LOG
;
print
"
$host
: ok
\n
";
...
...
@@ -429,7 +436,7 @@ exit 0;
sub
usage
{
print
<<EOF;
$0 version 1.
4
$0 version 1.
5
$0 takes the following options:
...
...
client/mysqladmin.c
View file @
05bbf3ef
...
...
@@ -24,7 +24,7 @@
#endif
#include <sys/stat.h>
#define ADMIN_VERSION "8.3
8
"
#define ADMIN_VERSION "8.3
9
"
#define MAX_MYSQL_VAR 128
#define SHUTDOWN_DEF_TIMEOUT 3600
/* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
...
...
@@ -70,7 +70,7 @@ static void print_relative_header();
static
void
print_relative_line
();
static
void
truncate_names
();
static
my_bool
get_pidfile
(
MYSQL
*
mysql
,
char
*
pidfile
);
static
void
wait_pidfile
(
char
*
pidfile
,
time_t
last_modified
,
static
my_bool
wait_pidfile
(
char
*
pidfile
,
time_t
last_modified
,
struct
stat
*
pidfile_status
);
static
void
store_values
(
MYSQL_RES
*
result
);
...
...
@@ -481,7 +481,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
printf
(
"Shutdown signal sent to server; Waiting for pid file to disappear
\n
"
);
/* Wait until pid file is gone */
wait_pidfile
(
pidfile
,
last_modified
,
&
pidfile_status
);
if
(
wait_pidfile
(
pidfile
,
last_modified
,
&
pidfile_status
))
return
-
1
;
}
break
;
}
...
...
@@ -1110,34 +1111,51 @@ static my_bool get_pidfile(MYSQL *mysql, char *pidfile)
return
1
;
/* Error */
}
/*
Return 1 if pid file didn't disappear or change
*/
static
void
wait_pidfile
(
char
*
pidfile
,
time_t
last_modified
,
static
my_bool
wait_pidfile
(
char
*
pidfile
,
time_t
last_modified
,
struct
stat
*
pidfile_status
)
{
char
buff
[
FN_REFLEN
];
int
fd
=
-
1
;
uint
count
=
0
;
int
error
=
1
;
uint
count
=
0
;
DBUG_ENTER
(
"wait_pidfile"
);
system_filename
(
buff
,
pidfile
);
while
(
count
++
<=
opt_shutdown_timeout
&&
!
interrupted
&&
(
!
last_modified
||
(
last_modified
==
pidfile_status
->
st_mtime
))
&&
(
fd
=
my_open
(
buff
,
O_RDONLY
,
MYF
(
0
)))
>=
0
)
do
{
i
f
(
!
my_close
(
fd
,
MYF
(
0
)))
fd
=
-
1
;
sleep
(
1
);
if
(
last_modified
&&
stat
(
pidfile
,
pidfile_status
))
last_modified
=
0
;
i
nt
fd
;
if
((
fd
=
my_open
(
buff
,
O_RDONLY
,
MYF
(
0
)))
<
0
)
{
error
=
0
;
break
;
}
if
(
opt_verbose
&&
last_modified
&&
last_modified
!=
pidfile_status
->
st_mtime
)
printf
(
"Warning; pid file '%s' changed while waiting for it to disappear!
\n
"
,
(
void
)
my_close
(
fd
,
MYF
(
0
));
if
(
last_modified
&&
!
stat
(
pidfile
,
pidfile_status
))
{
if
(
last_modified
!=
pidfile_status
->
st_mtime
)
{
/* File changed; Let's assume that mysqld did restart */
if
(
opt_verbose
)
printf
(
"pid file '%s' changed while waiting for it to disappear!
\n
mysqld did probably restart
\n
"
,
buff
);
if
(
fd
>=
0
)
error
=
0
;
break
;
}
}
if
(
count
++
==
opt_shutdown_timeout
)
break
;
sleep
(
1
);
}
while
(
!
interrupted
);
if
(
error
)
{
my_close
(
fd
,
MYF
(
0
));
DBUG_PRINT
(
"warning"
,(
"Pid file didn't disappear"
));
fprintf
(
stderr
,
"Warning; Aborted waiting on pid file: '%s' after %d seconds
\n
"
,
buff
,
count
-
1
);
}
DBUG_RETURN
(
error
);
}
client/mysqltest.c
View file @
05bbf3ef
...
...
@@ -42,7 +42,7 @@
**********************************************************************/
#define MTEST_VERSION "1.2
5
"
#define MTEST_VERSION "1.2
6
"
#include <my_global.h>
#include <mysql_embed.h>
...
...
@@ -1797,10 +1797,8 @@ int read_query(struct st_query** q_ptr)
static
struct
my_option
my_long_options
[]
=
{
#ifndef DBUG_OFF
{
"debug"
,
'#'
,
"Output debug log. Often this is 'd:t:o,filename'"
,
0
,
0
,
0
,
GET_STR
,
OPT_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
#endif
{
"database"
,
'D'
,
"Database to use."
,
(
gptr
*
)
&
db
,
(
gptr
*
)
&
db
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"basedir"
,
'b'
,
"Basedir for tests"
,
(
gptr
*
)
&
opt_basedir
,
...
...
@@ -1893,7 +1891,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
{
switch
(
optid
)
{
case
'#'
:
#ifndef DBUG_OFF
DBUG_PUSH
(
argument
?
argument
:
"d:t:S:i:O,/tmp/mysqltest.trace"
);
#endif
break
;
case
'r'
:
record
=
1
;
...
...
@@ -1971,7 +1971,7 @@ int parse_args(int argc, char **argv)
default_argv
=
argv
;
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
exit
(
ho_error
);
exit
(
1
);
if
(
argc
>
1
)
{
...
...
mysql-test/mysql-test-run.sh
View file @
05bbf3ef
...
...
@@ -88,6 +88,7 @@ sleep_until_file_created ()
wait_for_pid
()
{
pid
=
$1
#$WAIT_PID pid $SLEEP_TIME_FOR_DELETE
}
# No paths below as we can't be sure where the program is!
...
...
@@ -343,9 +344,9 @@ while test $# -gt 0; do
;;
--debug
)
EXTRA_MASTER_MYSQLD_OPT
=
"
$EXTRA_MASTER_MYSQLD_OPT
\
--debug=d:t:i:
O
,
$MYSQL_TEST_DIR
/var/log/master.trace"
--debug=d:t:i:
A
,
$MYSQL_TEST_DIR
/var/log/master.trace"
EXTRA_SLAVE_MYSQLD_OPT
=
"
$EXTRA_SLAVE_MYSQLD_OPT
\
--debug=d:t:i:
O
,
$MYSQL_TEST_DIR
/var/log/slave.trace"
--debug=d:t:i:
A
,
$MYSQL_TEST_DIR
/var/log/slave.trace"
EXTRA_MYSQL_TEST_OPT
=
"
$EXTRA_MYSQL_TEST_OPT
--debug"
;;
--fast
)
...
...
@@ -419,6 +420,7 @@ if [ x$SOURCE_DIST = x1 ] ; then
fi
MYSQLADMIN
=
"
$BASEDIR
/client/mysqladmin"
WAIT_PID
=
"
$BASEDIR
/extra/mysql_waitpid"
MYSQL_MANAGER_CLIENT
=
"
$BASEDIR
/client/mysqlmanagerc"
MYSQL_MANAGER
=
"
$BASEDIR
/tools/mysqlmanager"
MYSQL_MANAGER_PWGEN
=
"
$BASEDIR
/client/mysqlmanager-pwgen"
...
...
@@ -435,6 +437,7 @@ else
fi
MYSQL_TEST
=
"
$BASEDIR
/bin/mysqltest"
MYSQLADMIN
=
"
$BASEDIR
/bin/mysqladmin"
WAIT_PID
=
"
$BASEDIR
/bin/mysql_waitpid"
MYSQL_MANAGER
=
"
$BASEDIR
/bin/mysqlmanager"
MYSQL_MANAGER_CLIENT
=
"
$BASEDIR
/bin/mysqlmanagerc"
MYSQL_MANAGER_PWGEN
=
"
$BASEDIR
/bin/mysqlmanager-pwgen"
...
...
@@ -749,9 +752,9 @@ manager_term()
{
pid
=
$1
ident
=
$2
shift
if
[
$USE_MANAGER
=
0
]
;
then
$MYSQLADMIN
--no-defaults
-uroot
--socket
=
$MYSQL_TMP_DIR
/
$ident
.sock
--connect_timeout
=
5
--shutdown_timeout
=
20 shutdown
>>
$MYSQL_MANAGER_LOG
2>&1
# Shutdown time must be high as slave may be in reconnect
$MYSQLADMIN
--no-defaults
-uroot
--socket
=
$MYSQL_TMP_DIR
/
$ident
.sock
--connect_timeout
=
5
--shutdown_timeout
=
70 shutdown
>>
$MYSQL_MANAGER_LOG
2>&1
res
=
$?
# Some systems require an extra connect
$MYSQLADMIN
--no-defaults
-uroot
--socket
=
$MYSQL_TMP_DIR
/
$ident
.sock
--connect_timeout
=
1 ping
>>
$MYSQL_MANAGER_LOG
2>&1
...
...
@@ -873,8 +876,8 @@ start_slave()
[
x
$SKIP_SLAVE
=
x1
]
&&
return
eval
"this_slave_running=
\$
SLAVE
$1_RUNNING
"
[
x
$this_slave_running
=
1
]
&&
return
#
w
hen testing fail-safe replication, we will have more than one slave
#in this case, we start secondary slaves with an argument
#
W
hen testing fail-safe replication, we will have more than one slave
#
in this case, we start secondary slaves with an argument
slave_ident
=
"slave
$1
"
if
[
-n
"
$1
"
]
;
then
...
...
@@ -982,9 +985,12 @@ EOF
mysql_start
()
{
$ECHO
"Starting MySQL daemon"
start_master
start_slave
# We should not start the deamon here as we don't know the argumens
# for the test. Better to let the test start the deamon
# $ECHO "Starting MySQL daemon"
# start_master
# start_slave
cd
$MYSQL_TEST_DIR
return
1
}
...
...
@@ -1085,8 +1091,6 @@ run_testcase ()
slave_init_script
=
$TESTDIR
/
$tname
-slave
.sh
slave_master_info_file
=
$TESTDIR
/
$tname
-slave-master-info
.opt
echo
$tname
>
$CURRENT_TEST
echo
"CURRENT_TEST:
$tname
"
>>
$SLAVE_MYERR
echo
"CURRENT_TEST:
$tname
"
>>
$MASTER_MYERR
SKIP_SLAVE
=
`
$EXPR
\(
$tname
: rpl
\)
=
0
`
if
[
$USE_MANAGER
=
1
]
;
then
many_slaves
=
`
$EXPR
\(
$tname
: rpl_failsafe
\)
!=
0
`
...
...
@@ -1123,13 +1127,17 @@ run_testcase ()
then
EXTRA_MASTER_OPT
=
`
$CAT
$master_opt_file
|
$SED
-e
"s;
\\
$MYSQL_TEST_DIR
;
$MYSQL_TEST_DIR
;"
`
stop_master
echo
"CURRENT_TEST:
$tname
"
>>
$MASTER_MYERR
start_master
else
if
[
!
-z
"
$EXTRA_MASTER_OPT
"
]
||
[
x
$MASTER_RUNNING
!=
x1
]
;
then
EXTRA_MASTER_OPT
=
""
stop_master
echo
"CURRENT_TEST:
$tname
"
>>
$MASTER_MYERR
start_master
else
echo
"CURRENT_TEST:
$tname
"
>>
$MASTER_MYERR
fi
fi
...
...
@@ -1159,7 +1167,10 @@ run_testcase ()
if
[
x
$do_slave_restart
=
x1
]
;
then
stop_slave
echo
"CURRENT_TEST:
$tname
"
>>
$SLAVE_MYERR
start_slave
else
echo
"CURRENT_TEST:
$tname
"
>>
$SLAVE_MYERR
fi
if
[
x
$many_slaves
=
x1
]
;
then
start_slave 1
...
...
sql-bench/bench-init.pl.sh
View file @
05bbf3ef
...
...
@@ -48,7 +48,10 @@ $opt_optimization="None";
$opt_hw
=
""
;
$opt_threads
=
5
;
$opt_time_limit
=
10
*
60
;
# Don't wait more than 10 min for some tests
if
(!
defined
(
$opt_time_limit
))
{
$opt_time_limit
=
10
*
60
;
# Don't wait more than 10 min for some tests
}
$log_prog_args
=
join
(
" "
, skip_arguments
(
\@
ARGV,
"comments"
,
"cmp"
,
"server"
,
"user"
,
"host"
,
"database"
,
"password"
,
...
...
sql-bench/crash-me.sh
View file @
05bbf3ef
...
...
@@ -39,7 +39,7 @@
# as such, and clarify ones such as "mediumint" with comments such as
# "3-byte int" or "same as xxx".
$version
=
"1.
59
"
;
$version
=
"1.
60
"
;
use DBI
;
use Getopt::Long
;
...
...
@@ -50,7 +50,7 @@ $opt_server="mysql"; $opt_host="localhost"; $opt_database="test";
$opt_dir
=
"limits"
;
$opt_user
=
$opt_password
=
""
;
$opt_verbose
=
""
;
$opt_debug
=
$opt_help
=
$opt_Information
=
$opt_restart
=
$opt_force
=
$opt_quick
=
0
;
$opt_log_all_queries
=
$opt_fix_limit_file
=
$opt_batch_mode
=
0
;
$opt_log_all_queries
=
$opt_fix_limit_file
=
$opt_batch_mode
=
$opt_version
=
0
;
$opt_db_start_cmd
=
""
;
# the db server start command
$opt_check_server
=
0
;
# Check if server is alive before each query
$opt_sleep
=
10
;
# time to sleep while starting the db server
...
...
@@ -68,8 +68,10 @@ GetOptions("Information","help","server=s","debug","user=s","password=s",
"database=s"
,
"restart"
,
"force"
,
"quick"
,
"log-all-queries"
,
"comment=s"
,
"host=s"
,
"fix-limit-file"
,
"dir=s"
,
"db-start-cmd=s"
,
"sleep=s"
,
"suffix=s"
,
"batch-mode"
,
"config-file=s"
,
"log-queries-to-file=s"
,
"check-server"
,
"version"
,
"verbose!"
=>
\$
opt_verbose
)
||
usage
()
;
usage
()
if
(
$opt_help
||
$opt_Information
)
;
version
()
&&
exit
(
0
)
if
(
$opt_version
)
;
$opt_suffix
=
'-'
.
$opt_suffix
if
(
length
(
$opt_suffix
)
!=
0
)
;
$opt_config_file
=
"
$pwd
/
$opt_dir
/
$opt_server$opt_suffix
.cfg"
...
...
@@ -1190,7 +1192,7 @@ else
# Test: NOROUND
{
my
$result
at
=
'undefined'
;
my
$result
=
'undefined'
;
my
$error
;
print
"NOROUND: "
;
save_incomplete
(
'func_extra_noround'
,
'Function NOROUND'
)
;
...
...
@@ -1199,21 +1201,25 @@ else
$error
=
safe_query_l
(
'func_extra_noround'
,
"select noround(22.6)
$end_query
"
)
;
if
(
$error
ne 1
)
# syntax error -- noround is not supported
{
$resultat
=
'no'
}
else
# Ok, now check if it really works
$result
=
'no'
}
else
# Ok, now check if it really works
{
$error
=
safe_query_l
(
'func_extra_noround'
,
[
"create table crash_me_nr (a int)"
,
"insert into crash_me_nr values(noround(10.2))"
,
"drop table crash_me_nr
$drop_attr
"
])
;
if
(
$error
eq 1
)
{
$resultat
=
"syntax only"
;
}
else
{
$resultat
=
'yes'
;
if
(
$error
==
1
)
{
$result
=
"syntax only"
;
}
else
{
$result
=
'yes'
;
}
}
print
"
$result
at
\n
"
;
save_config_data
(
'func_extra_noround'
,
$result
at
,
"Function NOROUND"
)
;
print
"
$result
\n
"
;
save_config_data
(
'func_extra_noround'
,
$result
,
"Function NOROUND"
)
;
}
check_parenthesis
(
"func_sql_"
,
"CURRENT_USER"
)
;
...
...
@@ -1377,7 +1383,7 @@ if ($limits{'type_sql_date'} eq 'yes')
# Test: WEEK()
{
my
$result
at
=
"no"
;
my
$result
=
"no"
;
my
$error
;
print
"WEEK:"
;
save_incomplete
(
'func_odbc_week'
,
'WEEK'
)
;
...
...
@@ -1388,17 +1394,17 @@ if ($limits{'type_sql_date'} eq 'yes')
# and 0 - EURO weeks
if
(
$error
==
-1
)
{
if
(
$last_result
==
4
)
{
$result
at
=
'USA'
;
$result
=
'USA'
;
}
else
{
$result
at
=
'error'
;
$result
=
'error'
;
add_log
(
'func_odbc_week'
,
" must return 4 or 5, but
$last_result
"
)
;
}
}
elsif
(
$error
==
0
)
{
$result
at
=
'EURO'
;
$result
=
'EURO'
;
}
print
"
$result
at
\n
"
;
save_config_data
(
'func_odbc_week'
,
$result
at
,
"WEEK"
)
;
print
"
$result
\n
"
;
save_config_data
(
'func_odbc_week'
,
$result
,
"WEEK"
)
;
}
my
$insert_query
=
'insert into crash_me_d values('
.
...
...
@@ -1498,7 +1504,7 @@ if ($limits{'type_sql_date'} eq 'yes')
# NOT id BETWEEN a and b
if
(
$limits
{
'func_where_not_between'
}
eq
'yes'
)
{
my
$result
at
=
'error'
;
my
$result
=
'error'
;
my
$err
;
my
$key
=
'not_id_between'
;
my
$prompt
=
'NOT ID BETWEEN interprets as ID NOT BETWEEN'
;
...
...
@@ -1512,15 +1518,15 @@ if ($limits{'func_where_not_between'} eq 'yes')
5,0
)
;
if
(
$err
eq 1
)
{
if
(
not defined
(
$last_result
))
{
$result
at
=
'no'
;
$result
=
'no'
;
}
;
}
;
if
(
$err
eq 0
)
{
$result
at
=
'yes'
;
$result
=
'yes'
;
}
;
safe_query_l
(
$key
,[
"drop table crash_me_b"
])
;
save_config_data
(
$key
,
$result
at
,
$prompt
)
;
print
"
$result
at
\n
"
;
save_config_data
(
$key
,
$result
,
$prompt
)
;
print
"
$result
\n
"
;
}
;
...
...
@@ -2018,37 +2024,44 @@ report("views","views",
# Test: foreign key
{
my
$result
at
=
'undefined'
;
my
$result
=
'undefined'
;
my
$error
;
print
"foreign keys: "
;
save_incomplete
(
'foreign_key'
,
'foreign keys'
)
;
# 1) check if foreign keys are supported
safe_query_l
(
'foreign_key'
,create_table
(
"crash_me_qf"
,[
"a integer not null"
]
,
safe_query_l
(
'foreign_key'
,
create_table
(
"crash_me_qf"
,
[
"a integer not null"
]
,
[
"primary key (a)"
]))
;
$error
=
safe_query_l
(
'foreign_key'
,
create_table
(
"crash_me_qf2"
,[
"a integer not null"
,
"foreign key (a) references crash_me_qf (a)"
]
,
[]))
;
$error
=
safe_query_l
(
'foreign_key'
,
create_table
(
"crash_me_qf2"
,
[
"a integer not null"
,
"foreign key (a) references crash_me_qf (a)"
]
,
[]))
;
if
(
$error
eq
1
)
# OK -- syntax is supported
if
(
$error
==
1
)
# OK -- syntax is supported
{
$result
at
=
'error'
;
$result
=
'error'
;
# now check if foreign key really works
safe_query_l
(
'foreign_key'
,
"insert into crash_me_qf values (1)"
)
;
if
(
safe_query_l
(
'foreign_key'
,
"insert into crash_me_qf2 values (2)"
)
eq 1
)
{
$resultat
=
'syntax only'
;
}
else
{
$resultat
=
'yes'
;
$result
=
'syntax only'
;
}
}
else
{
$resultat
=
"no"
;
else
{
$result
=
'yes'
;
}
safe_query_l
(
'foreign_key'
,
"drop table crash_me_qf2
$drop_attr
"
,
"drop table crash_me_qf
$drop_attr
"
)
;
print
"
$resultat
\n
"
;
save_config_data
(
'foreign_key'
,
$resultat
,
"foreign keys"
)
;
}
else
{
$result
=
"no"
;
}
safe_query_l
(
'foreign_key'
,
"drop table crash_me_qf2
$drop_attr
"
)
;
safe_query_l
(
'foreign_key'
,
"drop table crash_me_qf
$drop_attr
"
)
;
print
"
$result
\n
"
;
save_config_data
(
'foreign_key'
,
$result
,
"foreign keys"
)
;
}
report
(
"Create SCHEMA"
,
"create_schema"
,
...
...
@@ -2607,7 +2620,7 @@ sub detect_null_position
sub check_parenthesis
{
my
$prefix
=
shift
;
my
$fn
=
shift
;
my
$result
at
=
'no'
;
my
$result
=
'no'
;
my
$param_name
=
$prefix
.lc
(
$fn
)
;
my
$r
;
...
...
@@ -2616,18 +2629,18 @@ sub check_parenthesis {
add_log
(
$param_name
,
$safe_query_log
)
;
if
(
$r
==
1
)
{
$result
at
=
"yes"
;
$result
=
"yes"
;
}
else
{
$r
=
safe_query
(
"select
$fn
()
$end_query
"
)
;
add_log
(
$param_name
,
$safe_query_log
)
;
if
(
$r
==
1
)
{
$result
at
=
"with_parenthesis"
;
$result
=
"with_parenthesis"
;
}
}
save_config_data
(
$param_name
,
$result
at
,
$fn
)
;
save_config_data
(
$param_name
,
$result
,
$fn
)
;
}
sub check_constraint
{
...
...
@@ -2699,10 +2712,16 @@ sub make_date {
}
sub version
{
print
"
$0
Ver
$version
\n
"
;
}
sub usage
{
version
()
;
print
<<
EOF
;
$0
Ver
$version
This program tries to find all limits and capabilities for a SQL
server. As it will use the server in some 'unexpected' ways, one
...
...
@@ -3110,7 +3129,6 @@ sub safe_query
$retry
=
$retry_limit
;
$retry_ok
=
1
;
$safe_query_log
.
=
"> OK
\n
"
;
}
$sth
->finish
;
}
...
...
sql-bench/test-alter-table.sh
View file @
05bbf3ef
...
...
@@ -27,6 +27,7 @@ $opt_start_field_count=8; # start with this many fields
$opt_loop_count
=
20
;
# How many tests to do
$opt_row_count
=
1000
;
# Rows in the table
$opt_field_count
=
1000
;
# Add until this many fields.
$opt_time_limit
=
10
*
60
;
# Don't wait more than 10 min for some tests
chomp
(
$pwd
=
`
pwd
`
)
;
$pwd
=
"."
if
(
$pwd
eq
''
)
;
require
"
$pwd
/bench-init.pl"
||
die
"Can't read Configuration file:
$!
\n
"
;
...
...
@@ -113,10 +114,9 @@ if ($opt_fast)
}
else
{
$add
=
1
if
(!
$limits
{
'alter_add_multi_col'
})
;
$add
=
1
if
(!
$limits
->
{
'alter_add_multi_col'
})
;
}
$count
=
0
;
while
(
$field_count
<
$opt_field_count
)
{
...
...
@@ -131,19 +131,43 @@ while ($field_count < $opt_field_count)
$tmp
=
""
if
(!
$multi_add
)
;
# Adabas
}
do_query
(
$dbh
,
"ALTER TABLE bench "
.
substr
(
$fields
,1
))
;
$end_time
=
new Benchmark
;
last
if
(
$estimated
=
predict_query_time
(
$loop_time
,
$end_time
,
\$
count,
$count
,
$opt_field_count
/
$add
+1
))
;
}
$end_time
=
new Benchmark
;
print
"Time for alter_table_add (
$count
): "
.
if
(
$estimated
)
{
print
"Estimated time"
;
}
else
{
print
"Time"
;
}
print
" for alter_table_add (
$count
): "
.
timestr
(
timediff
(
$end_time
,
$loop_time
)
,
"all"
)
.
"
\n\n
"
;
#
# If estimated, fix table to have known number of fields
#
if
(
$estimated
&&
$field_count
<
$opt_field_count
)
{
$fields
=
""
;
$tmp
=
"ADD "
;
while
(
$field_count
<
$opt_field_count
)
{
$field_count
++
;
$fields
.
=
",
$tmp
i
${
field_count
}
integer"
;
$tmp
=
""
if
(!
$multi_add
)
;
# Adabas
}
do_query
(
$dbh
,
"ALTER TABLE bench "
.
substr
(
$fields
,1
))
;
}
####
#### Test adding and deleting index on the first $opt_start_fields
####
$loop_time
=
new Benchmark
;
for
(
$i
=
1
;
$i
<
$opt_start_field_count
;
$i
++
)
$count
=
0
;
for
(
$i
=
1
;
$i
<
=
$opt_start_field_count
;
$i
++
)
{
$dbh
->do
(
"CREATE INDEX bench_ind
$i
ON bench (i
${
i
}
)"
)
||
die
$DBI
::errstr
;
}
...
...
@@ -153,7 +177,7 @@ print "Time for create_index ($opt_start_field_count): " .
timestr
(
timediff
(
$end_time
,
$loop_time
)
,
"all"
)
.
"
\n\n
"
;
$loop_time
=
new Benchmark
;
for
(
$i
=
1
;
$i
<
$opt_start_field_count
;
$i
++
)
for
(
$i
=
1
;
$i
<
=
$opt_start_field_count
;
$i
++
)
{
$dbh
->do
(
$server
->drop_index
(
"bench"
,
"bench_ind
$i
"
))
||
die
$DBI
::errstr
;
}
...
...
@@ -182,10 +206,17 @@ while ($field_count > $opt_start_field_count)
}
$dbh
->do
(
"ALTER TABLE bench "
.
substr
(
$fields
,1
)
.
$server
->
{
'drop_attr'
})
||
die
$DBI
::errstr
;
$end_time
=
new Benchmark
;
last
if
(
$estimated
=
predict_query_time
(
$loop_time
,
$end_time
,
\$
count,
$count
,
$opt_field_count
/
$add
+1
))
;
}
$end_time
=
new Benchmark
;
print
"Time for alter_table_drop (
$count
): "
.
if
(
$estimated
)
{
print
"Estimated time"
;
}
else
{
print
"Time"
;
}
print
" for alter_table_drop (
$count
): "
.
timestr
(
timediff
(
$end_time
,
$loop_time
)
,
"all"
)
.
"
\n\n
"
;
skip_dropcol:
...
...
sql-bench/test-insert.sh
View file @
05bbf3ef
...
...
@@ -21,10 +21,11 @@
# $opt_loop_count rows in random order
#
# changes made for Oracle compatibility
# - $limits{'func_odbc_mod'} is OK from crash-me, but it fails here so set we
# - $limits
->
{'func_odbc_mod'} is OK from crash-me, but it fails here so set we
# set it to 0 in server-cfg
# - the default server config runs out of rollback segments, so I added a couple
# of disconnect/connects to reset
# - the default server config runs out of rollback segments, so we added a
# couple of disconnect/connects to reset
#
##################### Standard benchmark inits ##############################
use DBI
;
...
...
sql/mysql_priv.h
View file @
05bbf3ef
...
...
@@ -772,7 +772,6 @@ uint calc_week(TIME *ltime, bool with_year, bool sunday_first_day_of_week,
void
find_date
(
char
*
pos
,
uint
*
vek
,
uint
flag
);
TYPELIB
*
convert_strings_to_array_type
(
my_string
*
typelibs
,
my_string
*
end
);
TYPELIB
*
typelib
(
List
<
String
>
&
strings
);
void
clean_up
(
bool
print_message
=
1
);
ulong
get_form_pos
(
File
file
,
uchar
*
head
,
TYPELIB
*
save_names
);
ulong
make_new_entry
(
File
file
,
uchar
*
fileinfo
,
TYPELIB
*
formnames
,
const
char
*
newname
);
...
...
sql/mysqld.cc
View file @
05bbf3ef
...
...
@@ -470,6 +470,7 @@ extern "C" pthread_handler_decl(handle_slave,arg);
static
uint
set_maximum_open_files
(
uint
max_file_limit
);
#endif
static
ulong
find_bit_type
(
const
char
*
x
,
TYPELIB
*
bit_lib
);
static
void
clean_up
(
bool
print_message
);
/****************************************************************************
** Code to end mysqld
...
...
@@ -742,13 +743,13 @@ void kill_mysql(void)
#if defined(OS2)
extern
"C"
void
kill_server
(
int
sig_ptr
)
#define RETURN_FROM_KILL_SERVER
return
#define RETURN_FROM_KILL_SERVER
DBUG_RETURN
#elif !defined(__WIN__)
static
void
*
kill_server
(
void
*
sig_ptr
)
#define RETURN_FROM_KILL_SERVER
return 0
#define RETURN_FROM_KILL_SERVER
DBUG_RETURN(0)
#else
static
void
__cdecl
kill_server
(
int
sig_ptr
)
#define RETURN_FROM_KILL_SERVER
return
#define RETURN_FROM_KILL_SERVER
DBUG_RETURN
#endif
{
int
sig
=
(
int
)
(
long
)
sig_ptr
;
// This is passed a int
...
...
@@ -827,7 +828,7 @@ extern "C" sig_handler print_signal_warning(int sig)
void
unireg_end
(
void
)
{
clean_up
();
clean_up
(
1
);
my_thread_end
();
#ifdef SIGNALS_DONT_BREAK_READ
exit
(
0
);
...
...
@@ -842,7 +843,7 @@ extern "C" void unireg_abort(int exit_code)
DBUG_ENTER
(
"unireg_abort"
);
if
(
exit_code
)
sql_print_error
(
"Aborting
\n
"
);
clean_up
();
/* purecov: inspected */
clean_up
(
1
);
/* purecov: inspected */
DBUG_PRINT
(
"quit"
,(
"done with cleanup in unireg_abort"
));
my_thread_end
();
exit
(
exit_code
);
/* purecov: inspected */
...
...
@@ -887,12 +888,12 @@ void clean_up(bool print_message)
regex_end
();
#endif
if
(
print_message
&&
errmesg
)
sql_print_error
(
ER
(
ER_SHUTDOWN_COMPLETE
),
my_progname
);
#if !defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
if
(
!
opt_bootstrap
)
(
void
)
my_delete
(
pidfile_name
,
MYF
(
0
));
// This may not always exist
#endif
if
(
print_message
&&
errmesg
)
sql_print_error
(
ER
(
ER_SHUTDOWN_COMPLETE
),
my_progname
);
x_free
((
gptr
)
my_errmsg
[
ERRMAPP
]);
/* Free messages */
DBUG_PRINT
(
"quit"
,
(
"Error messages freed"
));
/* Tell main we are ready */
...
...
@@ -902,6 +903,10 @@ void clean_up(bool print_message)
/* do the broadcast inside the lock to ensure that my_end() is not called */
(
void
)
pthread_cond_broadcast
(
&
COND_thread_count
);
(
void
)
pthread_mutex_unlock
(
&
LOCK_thread_count
);
/*
The following lines may never be executed as the main thread may have
killed us
*/
DBUG_PRINT
(
"quit"
,
(
"done with cleanup"
));
}
/* clean_up */
...
...
@@ -1481,7 +1486,7 @@ static void init_signals(void)
/* Change limits so that we will get a core file */
struct
rlimit
rl
;
rl
.
rlim_cur
=
rl
.
rlim_max
=
RLIM_INFINITY
;
if
(
setrlimit
(
RLIMIT_CORE
,
&
rl
))
if
(
setrlimit
(
RLIMIT_CORE
,
&
rl
)
&&
global_system_variables
.
log_warnings
)
sql_print_error
(
"Warning: setrlimit could not change the size of core files to 'infinity'; We may not be able to generate a core file on signals"
);
}
#endif
...
...
@@ -1550,8 +1555,11 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
my_thread_init
();
// Init new thread
DBUG_ENTER
(
"signal_hand"
);
SIGNAL_THD
;
/* Setup alarm handler */
init_thr_alarm
(
max_connections
+
max_insert_delayed_threads
);
/*
Setup alarm handler
The two extra handlers are for slave threads
*/
init_thr_alarm
(
max_connections
+
max_insert_delayed_threads
+
2
);
#if SIGINT != THR_KILL_SIGNAL
(
void
)
sigemptyset
(
&
set
);
// Setup up SIGINT for debug
(
void
)
sigaddset
(
&
set
,
SIGINT
);
// For debugging
...
...
@@ -1639,12 +1647,15 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
}
break
;
case
SIGHUP
:
if
(
!
abort_loop
)
{
reload_acl_and_cache
((
THD
*
)
0
,
(
REFRESH_LOG
|
REFRESH_TABLES
|
REFRESH_FAST
|
REFRESH_STATUS
|
REFRESH_GRANT
|
REFRESH_THREADS
|
REFRESH_HOSTS
),
REFRESH_STATUS
|
REFRESH_GRANT
|
REFRESH_THREADS
|
REFRESH_HOSTS
),
(
TABLE_LIST
*
)
0
);
// Flush logs
mysql_print_status
((
THD
*
)
0
);
// Send debug some info
}
break
;
#ifdef USE_ONE_SIGNAL_HAND
case
THR_SERVER_ALARM
:
...
...
sql/net_pkg.cc
View file @
05bbf3ef
...
...
@@ -134,7 +134,10 @@ net_printf(NET *net, uint errcode, ...)
{
if
(
thd
&&
thd
->
bootstrap
)
{
/* In bootstrap it's ok to print on stderr */
/*
In bootstrap it's ok to print on stderr
This may also happen when we get an error from a slave thread
*/
fprintf
(
stderr
,
"ERROR: %d %s
\n
"
,
errcode
,
text_pos
);
thd
->
fatal_error
=
1
;
}
...
...
sql/slave.cc
View file @
05bbf3ef
...
...
@@ -376,6 +376,7 @@ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock)
}
if
((
thread_mask
&
(
SLAVE_IO
|
SLAVE_FORCE_ALL
))
&&
mi
->
slave_running
)
{
DBUG_PRINT
(
"info"
,(
"Terminating IO thread"
));
mi
->
abort_slave
=
1
;
if
((
error
=
terminate_slave_thread
(
mi
->
io_thd
,
io_lock
,
io_cond_lock
,
...
...
@@ -386,6 +387,7 @@ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock)
}
if
((
thread_mask
&
(
SLAVE_SQL
|
SLAVE_FORCE_ALL
))
&&
mi
->
rli
.
slave_running
)
{
DBUG_PRINT
(
"info"
,(
"Terminating SQL thread"
));
DBUG_ASSERT
(
mi
->
rli
.
sql_thd
!=
0
)
;
mi
->
rli
.
abort_slave
=
1
;
if
((
error
=
terminate_slave_thread
(
mi
->
rli
.
sql_thd
,
sql_lock
,
...
...
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