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
d35d4eab
Commit
d35d4eab
authored
Jan 03, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
parents
a981ca05
c725e090
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
545 additions
and
287 deletions
+545
-287
client/mysqltest.c
client/mysqltest.c
+3
-1
mysql-test/lib/mtr_process.pl
mysql-test/lib/mtr_process.pl
+204
-158
mysql-test/lib/mtr_report.pl
mysql-test/lib/mtr_report.pl
+6
-1
mysql-test/mysql-test-run.pl
mysql-test/mysql-test-run.pl
+228
-54
mysql-test/r/alter_table.result
mysql-test/r/alter_table.result
+1
-1
mysql-test/r/grant2.result
mysql-test/r/grant2.result
+14
-3
mysql-test/r/grant_cache.result
mysql-test/r/grant_cache.result
+3
-3
mysql-test/r/ps_1general.result
mysql-test/r/ps_1general.result
+2
-2
mysql-test/r/timezone2.result
mysql-test/r/timezone2.result
+2
-2
mysql-test/r/variables.result
mysql-test/r/variables.result
+3
-3
mysql-test/t/grant2.test
mysql-test/t/grant2.test
+24
-4
mysql-test/t/multi_update.test
mysql-test/t/multi_update.test
+2
-0
mysql-test/t/variables.test
mysql-test/t/variables.test
+2
-2
sql/sql_acl.cc
sql/sql_acl.cc
+51
-53
No files found.
client/mysqltest.c
View file @
d35d4eab
...
@@ -538,7 +538,6 @@ static void free_used_memory()
...
@@ -538,7 +538,6 @@ static void free_used_memory()
mysql_server_end
();
mysql_server_end
();
if
(
ps_protocol
)
if
(
ps_protocol
)
ps_free_reg
();
ps_free_reg
();
my_end
(
MY_CHECK_ERROR
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -556,6 +555,7 @@ static void die(const char* fmt, ...)
...
@@ -556,6 +555,7 @@ static void die(const char* fmt, ...)
}
}
va_end
(
args
);
va_end
(
args
);
free_used_memory
();
free_used_memory
();
my_end
(
MY_CHECK_ERROR
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -568,6 +568,7 @@ static void abort_not_supported_test()
...
@@ -568,6 +568,7 @@ static void abort_not_supported_test()
if
(
!
silent
)
if
(
!
silent
)
printf
(
"skipped
\n
"
);
printf
(
"skipped
\n
"
);
free_used_memory
();
free_used_memory
();
my_end
(
MY_CHECK_ERROR
);
exit
(
2
);
exit
(
2
);
}
}
...
@@ -3655,6 +3656,7 @@ int main(int argc, char **argv)
...
@@ -3655,6 +3656,7 @@ int main(int argc, char **argv)
if
(
!
got_end_timer
)
if
(
!
got_end_timer
)
timer_output
();
/* No end_timer cmd, end it */
timer_output
();
/* No end_timer cmd, end it */
free_used_memory
();
free_used_memory
();
my_end
(
MY_CHECK_ERROR
);
exit
(
error
?
1
:
0
);
exit
(
error
?
1
:
0
);
return
error
?
1
:
0
;
/* Keep compiler happy */
return
error
?
1
:
0
;
/* Keep compiler happy */
}
}
...
...
mysql-test/lib/mtr_process.pl
View file @
d35d4eab
...
@@ -4,13 +4,14 @@
...
@@ -4,13 +4,14 @@
# and is part of the translation of the Bourne shell script with the
# and is part of the translation of the Bourne shell script with the
# same name.
# same name.
use
Carp
qw(cluck)
;
use
strict
;
use
strict
;
use
POSIX
"
:sys_wait_h
";
use
POSIX
"
:sys_wait_h
";
sub
mtr_run
($$$$$$);
sub
mtr_run
($$$$$$);
sub
mtr_spawn
($$$$$$);
sub
mtr_spawn
($$$$$$);
sub
mtr_stop_
servers
(
$);
sub
mtr_stop_
mysqld_servers
($
$);
sub
mtr_kill_leftovers
();
sub
mtr_kill_leftovers
();
# static in C
# static in C
...
@@ -77,13 +78,21 @@ sub spawn_impl ($$$$$$$) {
...
@@ -77,13 +78,21 @@ sub spawn_impl ($$$$$$$) {
if
(
$::opt_script_debug
)
if
(
$::opt_script_debug
)
{
{
print
STDERR
"
-
"
x
78
,
"
\n
";
print
STDERR
"
\n
";
print
STDERR
"
STDIN
$input
\n
"
if
$input
;
print
STDERR
"
####
",
"
-
"
x
78
,
"
\n
";
print
STDERR
"
STDOUT
$output
\n
"
if
$output
;
print
STDERR
"
####
",
"
STDIN
$input
\n
"
if
$input
;
print
STDERR
"
STDERR
$error
\n
"
if
$error
;
print
STDERR
"
####
",
"
STDOUT
$output
\n
"
if
$output
;
print
STDERR
"
DAEMON
\n
"
if
!
$join
;
print
STDERR
"
####
",
"
STDERR
$error
\n
"
if
$error
;
print
STDERR
"
EXEC
$path
",
join
("
",
@$arg_list_t
),
"
\n
";
if
(
$join
)
print
STDERR
"
-
"
x
78
,
"
\n
";
{
print
STDERR
"
####
",
"
run
";
}
else
{
print
STDERR
"
####
",
"
spawn
";
}
print
STDERR
"
$path
",
join
("
",
@$arg_list_t
),
"
\n
";
print
STDERR
"
####
",
"
-
"
x
78
,
"
\n
";
}
}
my
$pid
=
fork
();
my
$pid
=
fork
();
...
@@ -101,11 +110,11 @@ sub spawn_impl ($$$$$$$) {
...
@@ -101,11 +110,11 @@ sub spawn_impl ($$$$$$$) {
my
$dumped_core
=
$?
&
128
;
my
$dumped_core
=
$?
&
128
;
if
(
$signal_num
)
if
(
$signal_num
)
{
{
die
("
spawn got signal
$signal_num
");
mtr_error
("
spawn got signal
$signal_num
");
}
}
if
(
$dumped_core
)
if
(
$dumped_core
)
{
{
die
("
spawn dumped core
");
mtr_error
("
spawn dumped core
");
}
}
return
$exit_value
;
return
$exit_value
;
}
}
...
@@ -127,22 +136,34 @@ sub spawn_impl ($$$$$$$) {
...
@@ -127,22 +136,34 @@ sub spawn_impl ($$$$$$$) {
if
(
$output
)
if
(
$output
)
{
{
open
(
STDOUT
,"
>
",
$output
)
or
die
"
Can't redirect STDOUT to
\"
$output
\"
: $!
";
if
(
!
open
(
STDOUT
,"
>
",
$output
)
)
{
mtr_error
("
can't redirect STDOUT to
\"
$output
\"
: $!
");
}
}
}
if
(
$error
)
if
(
$error
)
{
{
if
(
$output
eq
$error
)
if
(
$output
eq
$error
)
{
{
open
(
STDERR
,"
>&STDOUT
")
or
die
"
Can't dup STDOUT: $!
";
if
(
!
open
(
STDERR
,"
>&STDOUT
")
)
{
mtr_error
("
can't dup STDOUT: $!
");
}
}
}
else
else
{
{
open
(
STDERR
,"
>
",
$error
)
or
die
"
Can't redirect STDERR to
\"
$output
\"
: $!
";
if
(
!
open
(
STDERR
,"
>
",
$error
)
)
{
mtr_error
("
can't redirect STDERR to
\"
$output
\"
: $!
");
}
}
}
}
}
if
(
$input
)
if
(
$input
)
{
{
open
(
STDIN
,"
<
",
$input
)
or
die
"
Can't redirect STDIN to
\"
$input
\"
: $!
";
if
(
!
open
(
STDIN
,"
<
",
$input
)
)
{
mtr_error
("
can't redirect STDIN to
\"
$input
\"
: $!
");
}
}
}
exec
(
$path
,
@$arg_list_t
);
exec
(
$path
,
@$arg_list_t
);
}
}
...
@@ -163,27 +184,25 @@ sub mtr_kill_leftovers () {
...
@@ -163,27 +184,25 @@ sub mtr_kill_leftovers () {
for
(
my
$idx
;
$idx
<
2
;
$idx
++
)
for
(
my
$idx
;
$idx
<
2
;
$idx
++
)
{
{
# if ( $::master->[$idx]->{'pid'} )
push
(
@args
,{
# {
pid
=>
0
,
# We don't know the PID
push
(
@args
,
pidfile
=>
$::master
->
[
$idx
]
->
{'
path_mypid
'},
$::master
->
[
$idx
]
->
{'
path_mypid
'},
sockfile
=>
$::master
->
[
$idx
]
->
{'
path_mysock
'},
$::master
->
[
$idx
]
->
{'
path_mysock
'},
port
=>
$::master
->
[
$idx
]
->
{'
path_myport
'},
);
});
# }
}
}
for
(
my
$idx
;
$idx
<
3
;
$idx
++
)
for
(
my
$idx
;
$idx
<
3
;
$idx
++
)
{
{
# if ( $::slave->[$idx]->{'pid'} )
push
(
@args
,{
# {
pid
=>
0
,
# We don't know the PID
push
(
@args
,
pidfile
=>
$::slave
->
[
$idx
]
->
{'
path_mypid
'},
$::slave
->
[
$idx
]
->
{'
path_mypid
'},
sockfile
=>
$::slave
->
[
$idx
]
->
{'
path_mysock
'},
$::slave
->
[
$idx
]
->
{'
path_mysock
'},
port
=>
$::slave
->
[
$idx
]
->
{'
path_myport
'},
);
});
# }
}
}
mtr_stop_
servers
(
\
@args
);
mtr_stop_
mysqld_servers
(
\
@args
,
1
);
# We scan the "var/run/" directory for other process id's to kill
# We scan the "var/run/" directory for other process id's to kill
my
$rundir
=
"
$::glob_mysql_test_dir/var/run
";
# FIXME $path_run_dir or something
my
$rundir
=
"
$::glob_mysql_test_dir/var/run
";
# FIXME $path_run_dir or something
...
@@ -211,17 +230,29 @@ sub mtr_kill_leftovers () {
...
@@ -211,17 +230,29 @@ sub mtr_kill_leftovers () {
}
}
closedir
(
RUNDIR
);
closedir
(
RUNDIR
);
my
$retries
=
10
;
# 10 seconds
start_reap_all
();
do
{
kill
(
9
,
@pids
);
}
while
(
$retries
--
and
kill
(
0
,
@pids
)
);
if
(
kill
(
0
,
@pids
)
)
if
(
$::glob_cygwin_perl
)
{
{
mtr_error
("
can't kill processes
"
.
join
("
",
@pids
));
# We have no (easy) way of knowing the Cygwin controlling
# process, in the PID file we only have the Windows process id.
system
("
kill -f
"
.
join
("
",
@pids
));
# Hope for the best....
}
}
else
{
my
$retries
=
10
;
# 10 seconds
do
{
kill
(
9
,
@pids
);
}
while
(
$retries
--
and
kill
(
0
,
@pids
)
);
if
(
kill
(
0
,
@pids
)
)
{
mtr_error
("
can't kill processes
"
.
join
("
",
@pids
));
}
}
stop_reap_all
();
}
}
}
}
...
@@ -237,185 +268,200 @@ sub mtr_kill_leftovers () {
...
@@ -237,185 +268,200 @@ sub mtr_kill_leftovers () {
# This is not perfect, there could still be other server processes
# This is not perfect, there could still be other server processes
# left.
# left.
sub
mtr_stop_servers
($)
{
# Force flag is to be set only for killing mysqld servers this script
my
$spec
=
shift
;
# didn't create in this run, i.e. initial cleanup before we start working.
# If force flag is set, we try to kill all with mysqladmin, and
# give up if we have no PIDs.
# First try nice normal shutdown using 'mysqladmin'
# FIXME On some operating systems, $srv->{'pid'} and $srv->{'pidfile'}
# will not be the same PID. We need to try to kill both I think.
{
sub
mtr_stop_mysqld_servers
($$)
{
my
@args
=
@$spec
;
my
$spec
=
shift
;
while
(
@args
)
my
$force
=
shift
;
{
my
$pidfile
=
shift
@args
;
# FIXME not used here....
my
$sockfile
=
shift
@args
;
if
(
-
f
$sockfile
)
{
# FIXME wrong log.....
# ----------------------------------------------------------------------
# FIXME, stderr.....
# If the process was not started from this file, we got no PID,
# Shutdown time must be high as slave may be in reconnect
# we try to find it in the PID file.
my
$opts
=
# ----------------------------------------------------------------------
[
"
--no-defaults
",
"
-uroot
",
"
--socket=
$sockfile
",
"
--connect_timeout=5
",
"
--shutdown_timeout=70
",
"
shutdown
",
];
# We don't wait for termination of mysqladmin
mtr_spawn
(
$::exe_mysqladmin
,
$opts
,
"",
$::path_manager_log
,
$::path_manager_log
,
"");
}
}
}
# Wait for them all to remove their socket file
my
$any_pid
=
0
;
# If we have any PIDs
SOCKREMOVED:
foreach
my
$srv
(
@$spec
)
for
(
my
$loop
=
$::opt_sleep_time_for_delete
;
$loop
;
$loop
--
)
{
{
my
$sockfiles_left
=
0
;
if
(
!
$srv
->
{'
pid
'}
and
-
f
$srv
->
{'
pidfile
'}
)
my
@args
=
@$spec
;
while
(
@args
)
{
{
my
$pidfile
=
shift
@args
;
$srv
->
{'
pid
'}
=
mtr_get_pid_from_file
(
$srv
->
{'
pidfile
'});
my
$sockfile
=
shift
@args
;
if
(
-
f
$sockfile
or
-
f
$pidfile
)
{
$sockfiles_left
++
;
# Could be that pidfile is left
}
}
}
if
(
!
$sockfiles_left
)
if
(
$srv
->
{'
pid
'}
)
{
{
last
SOCKREMOVED
;
$any_pid
=
1
;
}
if
(
$loop
>
1
)
{
sleep
(
1
);
# One second
}
}
}
}
# We may have killed all that left a socket, but we are not sure we got
# If the processes where started from this script, and we know
# them all killed. We now check the PID file, if any
# no PIDs, then we don't have to do anything.
if
(
!
$any_pid
and
!
$force
)
{
# cluck "This is how we got here!";
return
;
}
# Try nice kill with SIG_TERM
# ----------------------------------------------------------------------
# First try nice normal shutdown using 'mysqladmin'
# ----------------------------------------------------------------------
start_reap_all
();
# Don't require waitpid() of children
foreach
my
$srv
(
@$spec
)
{
{
my
@args
=
@$spec
;
if
(
-
e
$srv
->
{'
sockfile
'}
or
$srv
->
{'
port
'}
)
while
(
@args
)
{
{
my
$pidfile
=
shift
@args
;
# FIXME wrong log.....
my
$sockfile
=
shift
@args
;
# FIXME, stderr.....
if
(
-
f
$pidfile
)
# Shutdown time must be high as slave may be in reconnect
my
$args
;
mtr_init_args
(
\
$args
);
mtr_add_arg
(
$args
,
"
--no-defaults
");
mtr_add_arg
(
$args
,
"
-uroot
");
if
(
-
e
$srv
->
{'
sockfile
'}
)
{
{
my
$pid
=
mtr_get_pid_from_file
(
$pidfile
);
mtr_add_arg
(
$args
,
"
--socket=%s
",
$srv
->
{'
sockfile
'});
mtr_warning
("
process
$pid
not cooperating with mysqladmin,
"
.
"
will send TERM signal to process
");
kill
(
15
,
$pid
);
# SIG_TERM
}
}
if
(
$srv
->
{'
port
'}
)
{
mtr_add_arg
(
$args
,
"
--port=%s
",
$srv
->
{'
port
'});
}
mtr_add_arg
(
$args
,
"
--connect_timeout=5
");
mtr_add_arg
(
$args
,
"
--shutdown_timeout=70
");
mtr_add_arg
(
$args
,
"
shutdown
");
# We don't wait for termination of mysqladmin
mtr_spawn
(
$::exe_mysqladmin
,
$args
,
"",
$::path_manager_log
,
$::path_manager_log
,
"");
}
}
}
}
# Wait for them all to
di
e
# Wait for them all to
remove their pid and socket fil
e
PIDSOCKFILEREMOVED:
for
(
my
$loop
=
$::opt_sleep_time_for_delete
;
$loop
;
$loop
--
)
for
(
my
$loop
=
$::opt_sleep_time_for_delete
;
$loop
;
$loop
--
)
{
{
my
$pidfiles_left
=
0
;
my
$pidsockfiles_left
=
0
;
my
@args
=
@$spec
;
foreach
my
$srv
(
@$spec
)
while
(
@args
)
{
{
my
$pidfile
=
shift
@args
;
if
(
-
e
$srv
->
{'
sockfile
'}
or
-
f
$srv
->
{'
pidfile
'}
)
my
$sockfile
=
shift
@args
;
if
(
-
f
$pidfile
)
{
{
$pid
files_left
++
;
$pid
sockfiles_left
++
;
# Could be that pidfile is left
}
}
}
}
if
(
!
$pidfiles_left
)
if
(
!
$pid
sock
files_left
)
{
{
return
;
last
PIDSOCKFILEREMOVED
;
}
if
(
$loop
>
1
)
{
sleep
(
1
);
# One second
}
}
mtr_debug
("
Sleep for 1 second waiting for pid and socket file removal
");
sleep
(
1
);
# One second
}
}
# Try hard kill with SIG_KILL
# ----------------------------------------------------------------------
# If no known PIDs, we have nothing more to try
# ----------------------------------------------------------------------
if
(
!
$any_pid
)
{
{
my
@args
=
@$spec
;
stop_reap_all
();
while
(
@args
)
return
;
{
my
$pidfile
=
shift
@args
;
my
$sockfile
=
shift
@args
;
if
(
-
f
$pidfile
)
{
my
$pid
=
mtr_get_pid_from_file
(
$pidfile
);
mtr_warning
("
$pid
did not die from TERM signal,
",
"
will send KILL signal to process
");
kill
(
9
,
$pid
);
}
}
}
}
# We check with Perl "kill 0" if process still exists
# ----------------------------------------------------------------------
# We may have killed all that left a socket, but we are not sure we got
# them all killed. If we suspect it lives, try nice kill with SIG_TERM.
# Note that for true Win32 processes, kill(0,$pid) will not return 1.
# ----------------------------------------------------------------------
PIDFILES
:
SIGNAL
:
for
(
my
$loop
=
$::opt_sleep_time_for_delete
;
$loop
;
$loop
--
)
for
each
my
$sig
(
15
,
9
)
{
{
my
$not_terminated
=
0
;
my
$process_left
=
0
;
my
@args
=
@$spec
;
foreach
my
$srv
(
@$spec
)
while
(
@args
)
{
{
my
$pidfile
=
shift
@args
;
if
(
$srv
->
{'
pid
'}
and
my
$sockfile
=
shift
@args
;
(
-
f
$srv
->
{'
pidfile
'}
or
kill
(
0
,
$srv
->
{'
pid
'})
)
)
if
(
-
f
$pidfile
)
{
{
my
$pid
=
mtr_get_pid_from_file
(
$pidfile
);
$process_left
++
;
if
(
!
kill
(
0
,
$pid
)
)
mtr_warning
("
process
$srv
->{'pid'} not cooperating,
"
.
{
"
will send signal
$sig
to process
");
$not_terminated
++
;
kill
(
$sig
,
$srv
->
{'
pid
'});
# SIG_TERM
mtr_warning
("
could't kill
$pid
");
}
}
if
(
!
$process_left
)
{
last
SIGNAL
;
}
}
}
}
if
(
!
$not_terminated
)
mtr_debug
("
Sleep for 5 seconds waiting for processes to die
");
{
sleep
(
5
);
# We wait longer than usual
last
PIDFILES
;
}
if
(
$loop
>
1
)
{
sleep
(
1
);
# One second
}
}
}
# ----------------------------------------------------------------------
# Now, we check if all we can find using kill(0,$pid) are dead,
# and just assume the rest are. We cleanup socket and PID files.
# ----------------------------------------------------------------------
{
{
my
$pidfiles_left
=
0
;
my
$errors
=
0
;
my
@args
=
@$spec
;
foreach
my
$srv
(
@$spec
)
while
(
@args
)
{
{
my
$pidfile
=
shift
@args
;
if
(
$srv
->
{'
pid
'}
)
my
$sockfile
=
shift
@args
;
if
(
-
f
$pidfile
)
{
{
if
(
!
unlink
(
$pidfile
)
)
if
(
kill
(
0
,
$srv
->
{'
pid
'})
)
{
# FIXME In Cygwin there seem to be some fast reuse
# of PIDs, so dying may not be the right thing to do.
$errors
++
;
mtr_warning
("
can't kill process
$srv
->{'pid'}
");
}
else
{
{
$pidfiles_left
++
;
# We managed to kill it at last
mtr_warning
("
could't delete
$pidfile
");
# FIXME In Cygwin, we will get here even if the process lives.
# Not needed as we know the process is dead, but to be safe
# we unlink and check success in two steps. We first unlink
# without checking the error code, and then check if the
# file still exists.
foreach
my
$file
(
$srv
->
{'
pidfile
'},
$srv
->
{'
sockfile
'})
{
unlink
(
$file
);
if
(
-
e
$file
)
{
$errors
++
;
mtr_warning
("
couldn't delete
$file
");
}
}
}
}
}
}
}
}
if
(
$
pidfiles_left
)
if
(
$
errors
)
{
{
mtr_error
("
one or more pid files could not be deleted
");
# We are in trouble, just die....
mtr_error
("
we could not kill or clean up all processes
");
}
}
}
}
stop_reap_all
();
# FIXME We just assume they are all dead, we don't know....
# FIXME We just assume they are all dead, we don't know....
}
}
sub
start_reap_all
{
$SIG
{
CHLD
}
=
'
IGNORE
';
# FIXME is this enough?
}
sub
stop_reap_all
{
$SIG
{
CHLD
}
=
'
DEFAULT
';
}
1
;
1
;
mysql-test/lib/mtr_report.pl
View file @
d35d4eab
...
@@ -14,6 +14,7 @@ sub mtr_report_test_skipped($);
...
@@ -14,6 +14,7 @@ sub mtr_report_test_skipped($);
sub
mtr_show_failed_diff
($);
sub
mtr_show_failed_diff
($);
sub
mtr_report_stats
($);
sub
mtr_report_stats
($);
sub
mtr_print_line
();
sub
mtr_print_line
();
sub
mtr_print_thick_line
();
sub
mtr_print_header
();
sub
mtr_print_header
();
sub
mtr_report
(@);
sub
mtr_report
(@);
sub
mtr_warning
(@);
sub
mtr_warning
(@);
...
@@ -214,6 +215,10 @@ sub mtr_print_line () {
...
@@ -214,6 +215,10 @@ sub mtr_print_line () {
print
'
-
'
x
55
,
"
\n
";
print
'
-
'
x
55
,
"
\n
";
}
}
sub
mtr_print_thick_line
()
{
print
'
=
'
x
55
,
"
\n
";
}
sub
mtr_print_header
()
{
sub
mtr_print_header
()
{
print
"
\n
";
print
"
\n
";
if
(
$::opt_timer
)
if
(
$::opt_timer
)
...
@@ -250,7 +255,7 @@ sub mtr_error (@) {
...
@@ -250,7 +255,7 @@ sub mtr_error (@) {
sub
mtr_debug
(@)
{
sub
mtr_debug
(@)
{
if
(
$::opt_script_debug
)
if
(
$::opt_script_debug
)
{
{
print
"
mysql-test-run: DEBUG
:
",
join
("
",
@_
),"
\n
";
print
STDERR
"
####
:
",
join
("
",
@_
),"
\n
";
}
}
}
}
...
...
mysql-test/mysql-test-run.pl
View file @
d35d4eab
...
@@ -67,6 +67,11 @@
...
@@ -67,6 +67,11 @@
# is to use the Devel::Trace package found at
# is to use the Devel::Trace package found at
# "http://www.plover.com/~mjd/perl/Trace/" and run this script like
# "http://www.plover.com/~mjd/perl/Trace/" and run this script like
# "perl -d:Trace mysql-test-run.pl"
# "perl -d:Trace mysql-test-run.pl"
#
# FIXME Save a PID file from this code as well, to record the process
# id we think it has. In Cygwin, a fork creates one Cygwin process,
# and then the real Win32 process. Cygwin Perl can only kill Cygwin
# processes. And "mysqld --bootstrap ..." doesn't save a PID file.
$
Devel::Trace::
TRACE
=
0
;
# Don't trace boring init stuff
$
Devel::Trace::
TRACE
=
0
;
# Don't trace boring init stuff
...
@@ -147,7 +152,9 @@ our @mysqld_src_dirs=
...
@@ -147,7 +152,9 @@ our @mysqld_src_dirs=
# Misc global variables
# Misc global variables
our
$glob_win32
=
0
;
our
$glob_win32
=
0
;
# OS and native Win32 executables
our
$glob_win32_perl
=
0
;
# ActiveState Win32 Perl
our
$glob_cygwin_perl
=
0
;
# Cygwin Perl
our
$glob_mysql_test_dir
=
undef
;
our
$glob_mysql_test_dir
=
undef
;
our
$glob_mysql_bench_dir
=
undef
;
our
$glob_mysql_bench_dir
=
undef
;
our
$glob_hostname
=
undef
;
our
$glob_hostname
=
undef
;
...
@@ -172,6 +179,9 @@ our $path_slave_load_tmpdir; # What is this?!
...
@@ -172,6 +179,9 @@ our $path_slave_load_tmpdir; # What is this?!
our
$path_my_basedir
;
our
$path_my_basedir
;
our
$opt_tmpdir
;
# A path but set directly on cmd line
our
$opt_tmpdir
;
# A path but set directly on cmd line
our
$opt_usage
;
our
$opt_suite
;
our
$opt_netware
;
our
$opt_netware
;
our
$opt_script_debug
=
0
;
# Script debugging, enable with --script-debug
our
$opt_script_debug
=
0
;
# Script debugging, enable with --script-debug
...
@@ -290,6 +300,7 @@ sub initial_setup ();
...
@@ -290,6 +300,7 @@ sub initial_setup ();
sub
command_line_setup
();
sub
command_line_setup
();
sub
executable_setup
();
sub
executable_setup
();
sub
kill_and_cleanup
();
sub
kill_and_cleanup
();
sub
collect_test_cases
($);
sub
sleep_until_file_created
($$);
sub
sleep_until_file_created
($$);
sub
ndbcluster_start
();
sub
ndbcluster_start
();
sub
ndbcluster_stop
();
sub
ndbcluster_stop
();
...
@@ -306,6 +317,7 @@ sub stop_masters_slaves ();
...
@@ -306,6 +317,7 @@ sub stop_masters_slaves ();
sub
stop_masters
();
sub
stop_masters
();
sub
stop_slaves
();
sub
stop_slaves
();
sub
run_mysqltest
($$);
sub
run_mysqltest
($$);
sub
usage
($);
######################################################################
######################################################################
#
#
...
@@ -378,7 +390,9 @@ sub initial_setup () {
...
@@ -378,7 +390,9 @@ sub initial_setup () {
$glob_scriptname
=
basename
(
$0
);
$glob_scriptname
=
basename
(
$0
);
$glob_win32
=
(
$^O
eq
"
MSWin32
");
$glob_win32_perl
=
(
$^O
eq
"
MSWin32
");
$glob_cygwin_perl
=
(
$^O
eq
"
cygwin
");
$glob_win32
=
(
$glob_win32_perl
or
$glob_cygwin_perl
);
# We require that we are in the "mysql-test" directory
# We require that we are in the "mysql-test" directory
# to run mysql-test-run
# to run mysql-test-run
...
@@ -399,6 +413,12 @@ sub initial_setup () {
...
@@ -399,6 +413,12 @@ sub initial_setup () {
# 'basedir' is always parent of "mysql-test" directory
# 'basedir' is always parent of "mysql-test" directory
$glob_mysql_test_dir
=
cwd
();
$glob_mysql_test_dir
=
cwd
();
if
(
$glob_cygwin_perl
)
{
# Windows programs like 'mysqld' needs Windows paths
$glob_mysql_test_dir
=
`
cygpath -m
$glob_mysql_test_dir
`;
chomp
(
$glob_mysql_test_dir
);
}
$glob_basedir
=
dirname
(
$glob_mysql_test_dir
);
$glob_basedir
=
dirname
(
$glob_mysql_test_dir
);
$glob_mysql_bench_dir
=
"
$glob_basedir
/mysql-bench
";
# FIXME make configurable
$glob_mysql_bench_dir
=
"
$glob_basedir
/mysql-bench
";
# FIXME make configurable
...
@@ -423,6 +443,7 @@ sub command_line_setup () {
...
@@ -423,6 +443,7 @@ sub command_line_setup () {
# These are defaults for things that are set on the command line
# These are defaults for things that are set on the command line
$opt_suite
=
"
main
";
# Special default suite
$opt_tmpdir
=
"
$glob_mysql_test_dir
/var/tmp
";
$opt_tmpdir
=
"
$glob_mysql_test_dir
/var/tmp
";
# FIXME maybe unneded?
# FIXME maybe unneded?
$path_manager_log
=
"
$glob_mysql_test_dir
/var/log/manager.log
";
$path_manager_log
=
"
$glob_mysql_test_dir
/var/log/manager.log
";
...
@@ -436,61 +457,85 @@ sub command_line_setup () {
...
@@ -436,61 +457,85 @@ sub command_line_setup () {
my
$opt_user
;
my
$opt_user
;
# Read the command line
# Read the command line
# Note: Keep list, and the order, in sync with usage at end of this file
GetOptions
(
GetOptions
(
'
bench
'
=>
\
$opt_bench
,
# Control what engine/variation to run
'
big-test
'
=>
\
$opt_big_test
,
'
client-gdb
'
=>
\
$opt_client_gdb
,
'
compress
'
=>
\
$opt_compress
,
'
ddd
'
=>
\
$opt_ddd
,
'
debug
'
=>
\
$opt_debug
,
'
do-test=s
'
=>
\
$opt_do_test
,
'
embedded-server
'
=>
\
$opt_embedded_server
,
'
embedded-server
'
=>
\
$opt_embedded_server
,
'
ps-protocol
'
=>
\
$opt_ps_protocol
,
'
ps-protocol
'
=>
\
$opt_ps_protocol
,
'
extern
'
=>
\
$opt_extern
,
'
bench
'
=>
\
$opt_bench
,
'
fast
'
=>
\
$opt_fast
,
'
small-bench
'
=>
\
$opt_small_bench
,
'
no-manager
'
=>
\
$opt_no_manager
,
# Control what test suites or cases to run
'
force
'
=>
\
$opt_force
,
'
force
'
=>
\
$opt_force
,
'
gcov
'
=>
\
$opt_gcov
,
'
with-ndbcluster
'
=>
\
$opt_with_ndbcluster
,
'
do-test=s
'
=>
\
$opt_do_test
,
'
suite=s
'
=>
\
$opt_suite
,
'
skip-rpl
'
=>
\
$opt_skip_rpl
,
'
skip-test=s
'
=>
\
$opt_skip_test
,
# Specify ports
'
master_port=i
'
=>
\
$opt_master_myport
,
'
slave_port=i
'
=>
\
$opt_slave_myport
,
'
ndbcluster_port=i
'
=>
\
$opt_ndbcluster_port
,
# Test case authoring
'
record
'
=>
\
$opt_record
,
# ???
'
mysqld=s
'
=>
\
$opt_extra_mysqld_opt
,
# Run test on running server
'
extern
'
=>
\
$opt_extern
,
'
ndbconnectstring=s
'
=>
\
$opt_ndbconnectstring
,
# Debugging
'
gdb
'
=>
\
$opt_gdb
,
'
gdb
'
=>
\
$opt_gdb
,
'
manual-gdb
'
=>
\
$opt_manual_gdb
,
'
client-gdb
'
=>
\
$opt_client_gdb
,
'
ddd
'
=>
\
$opt_ddd
,
'
strace-client
'
=>
\
$opt_strace_client
,
'
master-binary=s
'
=>
\
$exe_master_mysqld
,
'
slave-binary=s
'
=>
\
$exe_slave_mysqld
,
# Coverage, profiling etc
'
gcov
'
=>
\
$opt_gcov
,
'
gprof
'
=>
\
$opt_gprof
,
'
gprof
'
=>
\
$opt_gprof
,
'
valgrind
'
=>
\
$opt_valgrind
,
'
valgrind-all
'
=>
\
$opt_valgrind_all
,
'
valgrind-options=s
'
=>
\
$opt_valgrind_options
,
# Misc
'
big-test
'
=>
\
$opt_big_test
,
'
compress
'
=>
\
$opt_compress
,
'
debug
'
=>
\
$opt_debug
,
'
fast
'
=>
\
$opt_fast
,
'
local
'
=>
\
$opt_local
,
'
local
'
=>
\
$opt_local
,
'
local-master
'
=>
\
$opt_local_master
,
'
local-master
'
=>
\
$opt_local_master
,
'
manual-gdb
'
=>
\
$opt_manual_gdb
,
'
master-binary=s
'
=>
\
$exe_master_mysqld
,
'
master_port=i
'
=>
\
$opt_master_myport
,
'
mysqld=s
'
=>
\
$opt_extra_mysqld_opt
,
'
ndbcluster_port=i
'
=>
\
$opt_ndbcluster_port
,
'
ndbconnectstring=s
'
=>
\
$opt_ndbconnectstring
,
'
netware
'
=>
\
$opt_netware
,
'
netware
'
=>
\
$opt_netware
,
'
no-manager
'
=>
\
$opt_no_manager
,
'
old-master
'
=>
\
$opt_old_master
,
'
old-master
'
=>
\
$opt_old_master
,
'
ps-protocol
'
=>
\
$opt_ps_protocol
,
'
record
'
=>
\
$opt_record
,
'
script-debug
'
=>
\
$opt_script_debug
,
'
script-debug
'
=>
\
$opt_script_debug
,
'
skip-rpl
'
=>
\
$opt_skip_rpl
,
'
skip-test=s
'
=>
\
$opt_skip_test
,
'
slave-binary=s
'
=>
\
$exe_slave_mysqld
,
'
slave_port=i
'
=>
\
$opt_slave_myport
,
'
sleep=i
'
=>
\
$opt_sleep
,
'
sleep=i
'
=>
\
$opt_sleep
,
'
small-bench
'
=>
\
$opt_small_bench
,
'
socket=s
'
=>
\
$opt_socket
,
'
socket=s
'
=>
\
$opt_socket
,
'
start-and-exit
'
=>
\
$opt_start_and_exit
,
'
start-and-exit
'
=>
\
$opt_start_and_exit
,
'
start-from=s
'
=>
\
$opt_start_from
,
'
start-from=s
'
=>
\
$opt_start_from
,
'
strace-client
'
=>
\
$opt_strace_client
,
'
timer
'
=>
\
$opt_timer
,
'
timer
'
=>
\
$opt_timer
,
'
tmpdir=s
'
=>
\
$opt_tmpdir
,
'
tmpdir=s
'
=>
\
$opt_tmpdir
,
'
user-test=s
'
=>
\
$opt_user_test
,
'
user-test=s
'
=>
\
$opt_user_test
,
'
user=s
'
=>
\
$opt_user
,
'
user=s
'
=>
\
$opt_user
,
'
valgrind
'
=>
\
$opt_valgrind
,
'
valgrind-all
'
=>
\
$opt_valgrind_all
,
'
valgrind-options=s
'
=>
\
$opt_valgrind_options
,
'
verbose
'
=>
\
$opt_verbose
,
'
verbose
'
=>
\
$opt_verbose
,
'
wait-timeout=i
'
=>
\
$opt_wait_timeout
,
'
wait-timeout=i
'
=>
\
$opt_wait_timeout
,
'
warnings|log-warnings
'
=>
\
$opt_warnings
,
'
warnings|log-warnings
'
=>
\
$opt_warnings
,
'
with-ndbcluster
'
=>
\
$opt_with_ndbcluster
,
'
with-openssl
'
=>
\
$opt_with_openssl
,
'
with-openssl
'
=>
\
$opt_with_openssl
,
'
help|h
'
=>
\
$opt_usage
,
)
or
usage
("
Can't read options
");
)
or
usage
("
Can't read options
");
if
(
$opt_usage
)
{
usage
("");
}
# Put this into a hash, will be a C struct
# Put this into a hash, will be a C struct
...
@@ -593,7 +638,7 @@ sub command_line_setup () {
...
@@ -593,7 +638,7 @@ sub command_line_setup () {
if
(
$opt_sleep
)
if
(
$opt_sleep
)
{
{
$opt_sleep_time_after_restart
=
$opt_sleep
;
$opt_sleep_time_after_restart
=
$opt_sleep
;
}
}
if
(
$opt_gcov
and
!
$opt_source_dist
)
if
(
$opt_gcov
and
!
$opt_source_dist
)
...
@@ -811,8 +856,22 @@ sub handle_int_signal () {
...
@@ -811,8 +856,22 @@ sub handle_int_signal () {
#
#
##############################################################################
##############################################################################
sub
collect_test_cases
()
{
sub
collect_test_cases
($)
{
my
$testdir
=
"
$glob_mysql_test_dir
/t
";
my
$suite
=
shift
;
# Test suite name
my
$testdir
;
my
$resdir
;
if
(
$suite
eq
"
main
"
)
{
$testdir
=
"
$glob_mysql_test_dir
/t
";
$resdir
=
"
$glob_mysql_test_dir
/r
";
}
else
{
$testdir
=
"
$glob_mysql_test_dir
/suite/
$suite
/t
";
$resdir
=
"
$glob_mysql_test_dir
/suite/
$suite
/r
";
}
my
@tests
;
# Array of hash, will be array of C struct
my
@tests
;
# Array of hash, will be array of C struct
...
@@ -839,7 +898,7 @@ sub collect_test_cases () {
...
@@ -839,7 +898,7 @@ sub collect_test_cases () {
my
$tinfo
=
{};
my
$tinfo
=
{};
$tinfo
->
{'
name
'}
=
$tname
;
$tinfo
->
{'
name
'}
=
$tname
;
$tinfo
->
{'
result_file
'}
=
"
r/
$tname
.result
";
$tinfo
->
{'
result_file
'}
=
"
$resdi
r
/
$tname
.result
";
push
(
@tests
,
$tinfo
);
push
(
@tests
,
$tinfo
);
if
(
$opt_skip_test
and
defined
mtr_match_prefix
(
$tname
,
$opt_skip_test
)
)
if
(
$opt_skip_test
and
defined
mtr_match_prefix
(
$tname
,
$opt_skip_test
)
)
...
@@ -947,7 +1006,7 @@ sub collect_test_cases () {
...
@@ -947,7 +1006,7 @@ sub collect_test_cases () {
if
(
-
f
$master_sh
)
if
(
-
f
$master_sh
)
{
{
if
(
$glob_win32
)
if
(
$glob_win32
_perl
)
{
{
$tinfo
->
{'
skip
'}
=
1
;
$tinfo
->
{'
skip
'}
=
1
;
}
}
...
@@ -960,7 +1019,7 @@ sub collect_test_cases () {
...
@@ -960,7 +1019,7 @@ sub collect_test_cases () {
if
(
-
f
$slave_sh
)
if
(
-
f
$slave_sh
)
{
{
if
(
$glob_win32
)
if
(
$glob_win32
_perl
)
{
{
$tinfo
->
{'
skip
'}
=
1
;
$tinfo
->
{'
skip
'}
=
1
;
}
}
...
@@ -1071,6 +1130,7 @@ sub sleep_until_file_created ($$) {
...
@@ -1071,6 +1130,7 @@ sub sleep_until_file_created ($$) {
{
{
return
;
return
;
}
}
mtr_debug
("
Sleep for 1 second waiting for creation of
$pidfile
");
sleep
(
1
);
sleep
(
1
);
}
}
...
@@ -1180,13 +1240,22 @@ sub run_benchmarks ($) {
...
@@ -1180,13 +1240,22 @@ sub run_benchmarks ($) {
#
#
##############################################################################
##############################################################################
# FIXME how to specify several suites to run? Comma separated list?
sub
run_tests
()
{
sub
run_tests
()
{
run_suite
(
$opt_suite
);
}
mtr_report
("
Finding Tests
");
sub
run_suite
()
{
my
$suite
=
shift
;
m
y
$tests
=
collect_test_cases
();
m
tr_print_thick_line
();
mtr_report
("
Starting Tests
");
mtr_report
("
Finding Tests in
$suite
suite
");
my
$tests
=
collect_test_cases
(
$suite
);
mtr_report
("
Starting Tests in
$suite
suite
");
mtr_print_header
();
mtr_print_header
();
...
@@ -1343,6 +1412,8 @@ sub run_testcase ($) {
...
@@ -1343,6 +1412,8 @@ sub run_testcase ($) {
# the preparation.
# the preparation.
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
mtr_report_test_name
(
$tinfo
);
mtr_tofile
(
$master
->
[
0
]
->
{'
path_myerr
'},"
CURRENT_TEST:
$tname
\n
");
mtr_tofile
(
$master
->
[
0
]
->
{'
path_myerr
'},"
CURRENT_TEST:
$tname
\n
");
do_before_start_master
(
$tname
,
$tinfo
->
{'
master_sh
'});
do_before_start_master
(
$tname
,
$tinfo
->
{'
master_sh
'});
...
@@ -1350,8 +1421,6 @@ sub run_testcase ($) {
...
@@ -1350,8 +1421,6 @@ sub run_testcase ($) {
# Start masters
# Start masters
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
mtr_report_test_name
(
$tinfo
);
if
(
!
$glob_use_running_server
and
!
$glob_use_embedded_server
)
if
(
!
$glob_use_running_server
and
!
$glob_use_embedded_server
)
{
{
# FIXME give the args to the embedded server?!
# FIXME give the args to the embedded server?!
...
@@ -1861,15 +1930,17 @@ sub stop_masters () {
...
@@ -1861,15 +1930,17 @@ sub stop_masters () {
# the mysqld process from being killed
# the mysqld process from being killed
if
(
$master
->
[
$idx
]
->
{'
pid
'}
)
if
(
$master
->
[
$idx
]
->
{'
pid
'}
)
{
{
push
(
@args
,
push
(
@args
,{
$master
->
[
$idx
]
->
{'
path_mypid
'},
pid
=>
$master
->
[
$idx
]
->
{'
pid
'},
$master
->
[
$idx
]
->
{'
path_mysock
'},
pidfile
=>
$master
->
[
$idx
]
->
{'
path_mypid
'},
);
sockfile
=>
$master
->
[
$idx
]
->
{'
path_mysock
'},
$master
->
[
$idx
]
->
{'
pid
'}
=
0
;
port
=>
$master
->
[
$idx
]
->
{'
path_myport
'},
});
$master
->
[
$idx
]
->
{'
pid
'}
=
0
;
# Assume we are done with it
}
}
}
}
mtr_stop_
servers
(
\
@args
);
mtr_stop_
mysqld_servers
(
\
@args
,
0
);
}
}
sub
stop_slaves
()
{
sub
stop_slaves
()
{
...
@@ -1881,15 +1952,17 @@ sub stop_slaves () {
...
@@ -1881,15 +1952,17 @@ sub stop_slaves () {
{
{
if
(
$slave
->
[
$idx
]
->
{'
pid
'}
)
if
(
$slave
->
[
$idx
]
->
{'
pid
'}
)
{
{
push
(
@args
,
push
(
@args
,{
$slave
->
[
$idx
]
->
{'
path_mypid
'},
pid
=>
$slave
->
[
$idx
]
->
{'
pid
'},
$slave
->
[
$idx
]
->
{'
path_mysock
'},
pidfile
=>
$slave
->
[
$idx
]
->
{'
path_mypid
'},
);
sockfile
=>
$slave
->
[
$idx
]
->
{'
path_mysock
'},
$slave
->
[
$idx
]
->
{'
pid
'}
=
0
;
port
=>
$slave
->
[
$idx
]
->
{'
path_myport
'},
});
$slave
->
[
$idx
]
->
{'
pid
'}
=
0
;
# Assume we are done with it
}
}
}
}
mtr_stop_
servers
(
\
@args
);
mtr_stop_
mysqld_servers
(
\
@args
,
0
);
}
}
...
@@ -2006,3 +2079,104 @@ sub run_mysqltest ($$) {
...
@@ -2006,3 +2079,104 @@ sub run_mysqltest ($$) {
return
mtr_run
(
$exe_mysqltest
,
$args
,
$tinfo
->
{'
path
'},"",
$path_timefile
,"");
return
mtr_run
(
$exe_mysqltest
,
$args
,
$tinfo
->
{'
path
'},"",
$path_timefile
,"");
}
}
##############################################################################
#
# Usage
#
##############################################################################
sub
usage
($)
{
print
STDERR
<<HERE;
mysql-test-run [ OPTIONS ] [ TESTCASE ]
FIXME when is TESTCASE arg used or not?!
Options to control what engine/variation to run
embedded-server Use the embedded server, i.e. no mysqld daemons
ps-protocol Use the binary protocol between client and server
bench Run the benchmark suite FIXME
small-bench FIXME
no-manager Use the istanse manager (currently disabled)
Options to control what test suites or cases to run
force Continue to run the suite after failure
with-ndbcluster Use cluster, and enable test cases that requres it
do-test=PREFIX Run test cases which name are prefixed with PREFIX
start-from=PREFIX Run test cases starting from test prefixed with PREFIX
suite=NAME Run the test suite named NAME. The default is "main"
skip-rpl Skip the replication test cases.
skip-test=PREFIX Skip test cases which name are prefixed with PREFIX
Options that specify ports
master_port=PORT Specify the port number used by the first master
slave_port=PORT Specify the port number used by the first slave
ndbcluster_port=i Specify the port number used by cluster FIXME
Options for test case authoring
record TESTNAME (Re)genereate the result file for TESTNAME
Options that pass on options
mysqld=ARGS Specify additional arguments to "mysqld"
Options to run test on running server
extern Use running server for tests FIXME DANGEROUS
ndbconnectstring=STR Use running cluster, and connect using STR
user=USER The databse user name
Options for debugging the product
gdb FIXME
manual-gdb FIXME
client-gdb FIXME
ddd FIXME
strace-client FIXME
master-binary=PATH Specify the master "mysqld" to use
slave-binary=PATH Specify the slave "mysqld" to use
Options for coverage, profiling etc
gcov FIXME
gprof FIXME
valgrind FIXME
valgrind-all FIXME
valgrind-options=ARGS Extra options to give valgrind
Misc options
verbose Verbose output from this script
script-debug Debug this script itself
compress Use the compressed protocol between client and server
timer Show test case execution time
start-and-exit Only initiate and start the "mysqld" servers
fast Don't try to cleanup from earlier runs
help Get this help text
Options not yet described, or that I want to look into more
big-test
debug
local
local-master
netware
old-master
sleep=SECONDS
socket=PATH
tmpdir=DIR
user-test=s
wait-timeout=SECONDS
warnings
log-warnings
with-openssl
HERE
exit
(
1
);
}
mysql-test/r/alter_table.result
View file @
d35d4eab
...
@@ -121,7 +121,7 @@ create database mysqltest;
...
@@ -121,7 +121,7 @@ create database mysqltest;
create table mysqltest.t1 (a int,b int,c int);
create table mysqltest.t1 (a int,b int,c int);
grant all on mysqltest.t1 to mysqltest_1@localhost;
grant all on mysqltest.t1 to mysqltest_1@localhost;
alter table t1 rename t2;
alter table t1 rename t2;
ERROR 42000:
insert
command denied to user 'mysqltest_1'@'localhost' for table 't2'
ERROR 42000:
INSERT,CREATE
command denied to user 'mysqltest_1'@'localhost' for table 't2'
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
delete from mysql.user where user=_binary'mysqltest_1';
delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest;
drop database mysqltest;
...
...
mysql-test/r/grant2.result
View file @
d35d4eab
...
@@ -37,7 +37,6 @@ show grants for current_user();
...
@@ -37,7 +37,6 @@ show grants for current_user();
Grants for mysqltest_1@localhost
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
use mysqltest;
insert into t1 values (1, 'I can''t change it!');
insert into t1 values (1, 'I can''t change it!');
update t1 set data='I can change it!' where id = 1;
update t1 set data='I can change it!' where id = 1;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
...
@@ -47,8 +46,20 @@ select * from t1;
...
@@ -47,8 +46,20 @@ select * from t1;
id data
id data
1 I can't change it!
1 I can't change it!
drop table t1;
drop table t1;
drop database mysqltest;
use test;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
flush privileges;
flush privileges;
create table t1 (a int, b int);
grant select (a) on t1 to mysqltest_1@localhost with grant option;
grant select (a,b) on t1 to mysqltest_2@localhost;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't1'
grant select on t1 to mysqltest_3@localhost;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
drop table t1;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
drop database mysqltest;
use test;
mysql-test/r/grant_cache.result
View file @
d35d4eab
...
@@ -134,7 +134,7 @@ a b c a
...
@@ -134,7 +134,7 @@ a b c a
1 1 1 test.t1
1 1 1 test.t1
2 2 2 test.t1
2 2 2 test.t1
select * from t2;
select * from t2;
ERROR 42000:
select
command denied to user 'mysqltest_2'@'localhost' for table 't2'
ERROR 42000:
SELECT
command denied to user 'mysqltest_2'@'localhost' for table 't2'
show status like "Qcache_queries_in_cache";
show status like "Qcache_queries_in_cache";
Variable_name Value
Variable_name Value
Qcache_queries_in_cache 6
Qcache_queries_in_cache 6
...
@@ -148,7 +148,7 @@ select "user3";
...
@@ -148,7 +148,7 @@ select "user3";
user3
user3
user3
user3
select * from t1;
select * from t1;
ERROR 42000:
select
command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
ERROR 42000:
SELECT
command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
select a from t1;
select a from t1;
a
a
1
1
...
@@ -156,7 +156,7 @@ a
...
@@ -156,7 +156,7 @@ a
select c from t1;
select c from t1;
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
select * from t2;
select * from t2;
ERROR 42000:
select
command denied to user 'mysqltest_3'@'localhost' for table 't2'
ERROR 42000:
SELECT
command denied to user 'mysqltest_3'@'localhost' for table 't2'
select mysqltest.t1.c from test.t1,mysqltest.t1;
select mysqltest.t1.c from test.t1,mysqltest.t1;
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
show status like "Qcache_queries_in_cache";
show status like "Qcache_queries_in_cache";
...
...
mysql-test/r/ps_1general.result
View file @
d35d4eab
...
@@ -834,7 +834,7 @@ execute s_t9 ;
...
@@ -834,7 +834,7 @@ execute s_t9 ;
my_col
my_col
1
1
select a as my_col from t1;
select a as my_col from t1;
ERROR 42000:
select
command denied to user 'second_user'@'localhost' for table 't1'
ERROR 42000:
SELECT
command denied to user 'second_user'@'localhost' for table 't1'
grant select on mysqltest.t1 to second_user@localhost
grant select on mysqltest.t1 to second_user@localhost
identified by 'looser' ;
identified by 'looser' ;
show grants for second_user@localhost ;
show grants for second_user@localhost ;
...
@@ -873,7 +873,7 @@ Grants for second_user@localhost
...
@@ -873,7 +873,7 @@ Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
execute s_t1 ;
execute s_t1 ;
ERROR 42000:
select
command denied to user 'second_user'@'localhost' for table 't1'
ERROR 42000:
SELECT
command denied to user 'second_user'@'localhost' for table 't1'
revoke all privileges, grant option from second_user@localhost ;
revoke all privileges, grant option from second_user@localhost ;
show grants for second_user@localhost ;
show grants for second_user@localhost ;
Grants for second_user@localhost
Grants for second_user@localhost
...
...
mysql-test/r/timezone2.result
View file @
d35d4eab
...
@@ -295,9 +295,9 @@ convert_tz(b, 'Europe/Moscow', 'UTC')
...
@@ -295,9 +295,9 @@ convert_tz(b, 'Europe/Moscow', 'UTC')
update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2);
where t1.a = t2.c and t2.d = (select max(d) from t2);
select * from mysql.time_zone_name;
select * from mysql.time_zone_name;
ERROR 42000:
select
command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
ERROR 42000:
SELECT
command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
ERROR 42000:
select
command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
ERROR 42000:
SELECT
command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
...
...
mysql-test/r/variables.result
View file @
d35d4eab
...
@@ -115,13 +115,13 @@ set global concurrent_insert=DEFAULT;
...
@@ -115,13 +115,13 @@ set global concurrent_insert=DEFAULT;
show variables like 'concurrent_insert';
show variables like 'concurrent_insert';
Variable_name Value
Variable_name Value
concurrent_insert ON
concurrent_insert ON
set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="
INNODB
";
set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="
MERGE
";
show local variables like 'storage_engine';
show local variables like 'storage_engine';
Variable_name Value
Variable_name Value
storage_engine HEAP
storage_engine HEAP
show global variables like 'storage_engine';
show global variables like 'storage_engine';
Variable_name Value
Variable_name Value
storage_engine
InnoDB
storage_engine
MERGE
set GLOBAL query_cache_size=100000;
set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000;
set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size';
show global variables like 'myisam_max_sort_file_size';
...
@@ -220,7 +220,7 @@ set max_join_size="hello";
...
@@ -220,7 +220,7 @@ set max_join_size="hello";
ERROR 42000: Incorrect argument type to variable 'max_join_size'
ERROR 42000: Incorrect argument type to variable 'max_join_size'
set storage_engine=UNKNOWN_TABLE_TYPE;
set storage_engine=UNKNOWN_TABLE_TYPE;
ERROR 42000: Unknown table engine 'UNKNOWN_TABLE_TYPE'
ERROR 42000: Unknown table engine 'UNKNOWN_TABLE_TYPE'
set storage_engine=
INNODB
, big_tables=2;
set storage_engine=
MERGE
, big_tables=2;
ERROR 42000: Variable 'big_tables' can't be set to the value of '2'
ERROR 42000: Variable 'big_tables' can't be set to the value of '2'
show local variables like 'storage_engine';
show local variables like 'storage_engine';
Variable_name Value
Variable_name Value
...
...
mysql-test/t/grant2.test
View file @
d35d4eab
...
@@ -50,10 +50,9 @@ flush privileges;
...
@@ -50,10 +50,9 @@ flush privileges;
use
mysqltest
;
use
mysqltest
;
create
table
t1
(
id
int
primary
key
,
data
varchar
(
255
));
create
table
t1
(
id
int
primary
key
,
data
varchar
(
255
));
connect
(
mrbad
,
localhost
,
mysqltest_1
,,);
connect
(
mrbad
,
localhost
,
mysqltest_1
,,
mysqltest
);
connection
mrbad
;
connection
mrbad
;
show
grants
for
current_user
();
show
grants
for
current_user
();
use
mysqltest
;
insert
into
t1
values
(
1
,
'I can''t change it!'
);
insert
into
t1
values
(
1
,
'I can''t change it!'
);
--
error
1044
--
error
1044
update
t1
set
data
=
'I can change it!'
where
id
=
1
;
update
t1
set
data
=
'I can change it!'
where
id
=
1
;
...
@@ -61,11 +60,32 @@ update t1 set data='I can change it!' where id = 1;
...
@@ -61,11 +60,32 @@ update t1 set data='I can change it!' where id = 1;
--
error
1044
--
error
1044
insert
into
t1
values
(
1
,
'XXX'
)
on
duplicate
key
update
data
=
'I can change it!'
;
insert
into
t1
values
(
1
,
'XXX'
)
on
duplicate
key
update
data
=
'I can change it!'
;
select
*
from
t1
;
select
*
from
t1
;
disconnect
mrbad
;
connection
default
;
drop
table
t1
;
delete
from
mysql
.
user
where
user
like
'mysqltest\_%'
;
delete
from
mysql
.
db
where
user
like
'mysqltest\_%'
;
flush
privileges
;
create
table
t1
(
a
int
,
b
int
);
grant
select
(
a
)
on
t1
to
mysqltest_1
@
localhost
with
grant
option
;
connect
(
mrugly
,
localhost
,
mysqltest_1
,,
mysqltest
);
connection
mrugly
;
--
error
1143
grant
select
(
a
,
b
)
on
t1
to
mysqltest_2
@
localhost
;
--
error
1142
grant
select
on
t1
to
mysqltest_3
@
localhost
;
disconnect
mrugly
;
connection
default
;
connection
default
;
drop
table
t1
;
drop
table
t1
;
drop
database
mysqltest
;
use
test
;
delete
from
mysql
.
user
where
user
like
'mysqltest\_%'
;
delete
from
mysql
.
user
where
user
like
'mysqltest\_%'
;
delete
from
mysql
.
db
where
user
like
'mysqltest\_%'
;
delete
from
mysql
.
db
where
user
like
'mysqltest\_%'
;
delete
from
mysql
.
tables_priv
where
user
like
'mysqltest\_%'
;
delete
from
mysql
.
columns_priv
where
user
like
'mysqltest\_%'
;
flush
privileges
;
flush
privileges
;
drop
database
mysqltest
;
use
test
;
mysql-test/t/multi_update.test
View file @
d35d4eab
...
@@ -433,6 +433,7 @@ delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2
...
@@ -433,6 +433,7 @@ delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
# Test for BUG#5837 - delete with outer join and const tables
# Test for BUG#5837 - delete with outer join and const tables
--
disable_warnings
create
table
t1
(
create
table
t1
(
aclid
bigint
not
null
primary
key
,
aclid
bigint
not
null
primary
key
,
status
tinyint
(
1
)
not
null
status
tinyint
(
1
)
not
null
...
@@ -442,6 +443,7 @@ create table t2 (
...
@@ -442,6 +443,7 @@ create table t2 (
refid
bigint
not
null
primary
key
,
refid
bigint
not
null
primary
key
,
aclid
bigint
,
index
idx_acl
(
aclid
)
aclid
bigint
,
index
idx_acl
(
aclid
)
)
engine
=
innodb
;
)
engine
=
innodb
;
--
enable_warnings
insert
into
t2
values
(
1
,
null
);
insert
into
t2
values
(
1
,
null
);
delete
t2
,
t1
from
t2
left
join
t1
on
(
t2
.
aclid
=
t1
.
aclid
)
where
t2
.
refid
=
'1'
;
delete
t2
,
t1
from
t2
left
join
t1
on
(
t2
.
aclid
=
t1
.
aclid
)
where
t2
.
refid
=
'1'
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
...
...
mysql-test/t/variables.test
View file @
d35d4eab
...
@@ -71,7 +71,7 @@ show variables like 'concurrent_insert';
...
@@ -71,7 +71,7 @@ show variables like 'concurrent_insert';
set
global
concurrent_insert
=
DEFAULT
;
set
global
concurrent_insert
=
DEFAULT
;
show
variables
like
'concurrent_insert'
;
show
variables
like
'concurrent_insert'
;
set
storage_engine
=
MYISAM
,
storage_engine
=
"HEAP"
,
global
storage_engine
=
"
INNODB
"
;
set
storage_engine
=
MYISAM
,
storage_engine
=
"HEAP"
,
global
storage_engine
=
"
MERGE
"
;
show
local
variables
like
'storage_engine'
;
show
local
variables
like
'storage_engine'
;
show
global
variables
like
'storage_engine'
;
show
global
variables
like
'storage_engine'
;
set
GLOBAL
query_cache_size
=
100000
;
set
GLOBAL
query_cache_size
=
100000
;
...
@@ -128,7 +128,7 @@ set max_join_size="hello";
...
@@ -128,7 +128,7 @@ set max_join_size="hello";
--
error
1286
--
error
1286
set
storage_engine
=
UNKNOWN_TABLE_TYPE
;
set
storage_engine
=
UNKNOWN_TABLE_TYPE
;
--
error
1231
--
error
1231
set
storage_engine
=
INNODB
,
big_tables
=
2
;
set
storage_engine
=
MERGE
,
big_tables
=
2
;
show
local
variables
like
'storage_engine'
;
show
local
variables
like
'storage_engine'
;
--
error
1229
--
error
1229
set
SESSION
query_cache_size
=
10000
;
set
SESSION
query_cache_size
=
10000
;
...
...
sql/sql_acl.cc
View file @
d35d4eab
...
@@ -964,9 +964,8 @@ static void acl_insert_db(const char *user, const char *host, const char *db,
...
@@ -964,9 +964,8 @@ static void acl_insert_db(const char *user, const char *host, const char *db,
ulong
acl_get
(
const
char
*
host
,
const
char
*
ip
,
ulong
acl_get
(
const
char
*
host
,
const
char
*
ip
,
const
char
*
user
,
const
char
*
db
,
my_bool
db_is_pattern
)
const
char
*
user
,
const
char
*
db
,
my_bool
db_is_pattern
)
{
{
ulong
host_access
,
db_access
;
ulong
host_access
=
~
0
,
db_access
=
0
;
uint
i
,
key_length
;
uint
i
,
key_length
;
db_access
=
0
;
host_access
=
~
0
;
char
key
[
ACL_KEY_LENGTH
],
*
tmp_db
,
*
end
;
char
key
[
ACL_KEY_LENGTH
],
*
tmp_db
,
*
end
;
acl_entry
*
entry
;
acl_entry
*
entry
;
DBUG_ENTER
(
"acl_get"
);
DBUG_ENTER
(
"acl_get"
);
...
@@ -2256,39 +2255,58 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
...
@@ -2256,39 +2255,58 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
}
}
if
(
columns
.
elements
&&
!
revoke_grant
)
if
(
!
revoke_grant
)
{
{
TABLE
*
table
;
if
(
columns
.
elements
&&
!
revoke_grant
)
class
LEX_COLUMN
*
column
;
List_iterator
<
LEX_COLUMN
>
column_iter
(
columns
);
if
(
!
(
table
=
open_ltable
(
thd
,
table_list
,
TL_READ
)))
DBUG_RETURN
(
-
1
);
while
((
column
=
column_iter
++
))
{
{
uint
unused_field_idx
=
NO_CACHED_FIELD_INDEX
;
TABLE
*
table
;
if
(
!
find_field_in_table
(
thd
,
table
,
column
->
column
.
ptr
(),
class
LEX_COLUMN
*
column
;
column
->
column
.
length
(),
0
,
0
,
List_iterator
<
LEX_COLUMN
>
column_iter
(
columns
);
&
unused_field_idx
))
if
(
!
(
table
=
open_ltable
(
thd
,
table_list
,
TL_READ
)))
DBUG_RETURN
(
-
1
);
while
((
column
=
column_iter
++
))
{
{
my_error
(
ER_BAD_FIELD_ERROR
,
MYF
(
0
),
uint
unused_field_idx
=
NO_CACHED_FIELD_INDEX
;
column
->
column
.
c_ptr
(),
table_list
->
alias
);
Field
*
f
=
find_field_in_table
(
thd
,
table
,
column
->
column
.
ptr
(),
DBUG_RETURN
(
-
1
);
column
->
column
.
length
(),
1
,
0
,
&
unused_field_idx
);
if
(
!
f
)
{
my_error
(
ER_BAD_FIELD_ERROR
,
MYF
(
0
),
column
->
column
.
c_ptr
(),
table_list
->
alias
);
DBUG_RETURN
(
-
1
);
}
if
(
f
==
(
Field
*
)
-
1
)
{
DBUG_RETURN
(
-
1
);
}
column_priv
|=
column
->
rights
;
}
}
c
olumn_priv
|=
column
->
rights
;
c
lose_thread_tables
(
thd
)
;
}
}
close_thread_tables
(
thd
);
else
}
else
if
(
!
(
rights
&
CREATE_ACL
)
&&
!
revoke_grant
)
{
char
buf
[
FN_REFLEN
];
sprintf
(
buf
,
"%s/%s/%s.frm"
,
mysql_data_home
,
table_list
->
db
,
table_list
->
real_name
);
fn_format
(
buf
,
buf
,
""
,
""
,
4
+
16
+
32
);
if
(
access
(
buf
,
F_OK
))
{
{
my_error
(
ER_NO_SUCH_TABLE
,
MYF
(
0
),
table_list
->
db
,
table_list
->
alias
);
if
(
!
(
rights
&
CREATE_ACL
))
DBUG_RETURN
(
-
1
);
{
char
buf
[
FN_REFLEN
];
sprintf
(
buf
,
"%s/%s/%s.frm"
,
mysql_data_home
,
table_list
->
db
,
table_list
->
real_name
);
fn_format
(
buf
,
buf
,
""
,
""
,
4
+
16
+
32
);
if
(
access
(
buf
,
F_OK
))
{
my_error
(
ER_NO_SUCH_TABLE
,
MYF
(
0
),
table_list
->
db
,
table_list
->
alias
);
DBUG_RETURN
(
-
1
);
}
}
if
(
table_list
->
grant
.
want_privilege
)
{
char
command
[
128
];
get_privilege_desc
(
command
,
sizeof
(
command
),
table_list
->
grant
.
want_privilege
);
my_error
(
ER_TABLEACCESS_DENIED_ERROR
,
MYF
(
0
),
command
,
thd
->
priv_user
,
thd
->
host_or_ip
,
table_list
->
alias
);
DBUG_RETURN
(
-
1
);
}
}
}
}
}
...
@@ -2773,25 +2791,8 @@ err:
...
@@ -2773,25 +2791,8 @@ err:
rw_unlock
(
&
LOCK_grant
);
rw_unlock
(
&
LOCK_grant
);
if
(
!
no_errors
)
// Not a silent skip of table
if
(
!
no_errors
)
// Not a silent skip of table
{
{
const
char
*
command
=
""
;
char
command
[
128
];
if
(
want_access
&
SELECT_ACL
)
get_privilege_desc
(
command
,
sizeof
(
command
),
want_access
);
command
=
"select"
;
else
if
(
want_access
&
INSERT_ACL
)
command
=
"insert"
;
else
if
(
want_access
&
UPDATE_ACL
)
command
=
"update"
;
else
if
(
want_access
&
DELETE_ACL
)
command
=
"delete"
;
else
if
(
want_access
&
DROP_ACL
)
command
=
"drop"
;
else
if
(
want_access
&
CREATE_ACL
)
command
=
"create"
;
else
if
(
want_access
&
ALTER_ACL
)
command
=
"alter"
;
else
if
(
want_access
&
INDEX_ACL
)
command
=
"index"
;
else
if
(
want_access
&
GRANT_ACL
)
command
=
"grant"
;
net_printf
(
thd
,
ER_TABLEACCESS_DENIED_ERROR
,
net_printf
(
thd
,
ER_TABLEACCESS_DENIED_ERROR
,
command
,
command
,
thd
->
priv_user
,
thd
->
priv_user
,
...
@@ -2906,11 +2907,8 @@ bool check_grant_all_columns(THD *thd, ulong want_access, TABLE *table)
...
@@ -2906,11 +2907,8 @@ bool check_grant_all_columns(THD *thd, ulong want_access, TABLE *table)
err:
err:
rw_unlock
(
&
LOCK_grant
);
rw_unlock
(
&
LOCK_grant
);
err2:
err2:
const
char
*
command
=
""
;
char
command
[
128
];
if
(
want_access
&
SELECT_ACL
)
get_privilege_desc
(
command
,
sizeof
(
command
),
want_access
);
command
=
"select"
;
else
if
(
want_access
&
INSERT_ACL
)
command
=
"insert"
;
my_printf_error
(
ER_COLUMNACCESS_DENIED_ERROR
,
my_printf_error
(
ER_COLUMNACCESS_DENIED_ERROR
,
ER
(
ER_COLUMNACCESS_DENIED_ERROR
),
ER
(
ER_COLUMNACCESS_DENIED_ERROR
),
MYF
(
0
),
MYF
(
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