Commit 7290fa2f authored by kostja@bodhi.local's avatar kostja@bodhi.local

Post-merge fixes.

parent ebb70704
This diff is collapsed.
......@@ -344,7 +344,7 @@ sub snapshot_setup ();
sub executable_setup ();
sub environment_setup ();
sub kill_running_server ();
sub kill_and_cleanup ();
sub cleanup_stale_files ();
sub check_ssl_support ();
sub check_running_as_root();
sub check_ndbcluster_support ();
......@@ -368,8 +368,6 @@ sub ndb_mgmd_start ($);
sub mysqld_start ($$$);
sub mysqld_arguments ($$$$$);
sub stop_all_servers ();
sub im_start ($$);
sub im_stop ($$);
sub run_mysqltest ($);
sub usage ($);
......@@ -1454,14 +1452,13 @@ sub kill_running_server () {
mtr_report("Killing Possible Leftover Processes");
mkpath("$opt_vardir/log"); # Needed for mysqladmin log
mtr_kill_leftovers();
}
}
sub kill_and_cleanup () {
kill_running_server ();
sub cleanup_stale_files () {
mtr_report("Removing Stale Files");
......@@ -1998,14 +1995,12 @@ sub run_suite () {
sub initialize_servers () {
if ( ! $glob_use_running_server )
{
if ( $opt_start_dirty )
{
kill_running_server();
}
else
unless ( $opt_start_dirty )
{
kill_and_cleanup();
cleanup_stale_files();
mysql_install_db();
if ( $opt_force )
{
......@@ -2397,10 +2392,9 @@ sub run_testcase ($) {
# Stop Instance Manager if we are processing an IM-test case.
# ----------------------------------------------------------------------
if ( ! $glob_use_running_server and $tinfo->{'component_id'} eq 'im' and
$instance_manager->{'pid'} )
if ( ! $glob_use_running_server and $tinfo->{'component_id'} eq 'im' )
{
im_stop($instance_manager, $tinfo->{'name'});
mtr_im_stop($instance_manager, $tinfo->{'name'});
}
}
......@@ -2937,11 +2931,8 @@ sub stop_all_servers () {
print "Stopping All Servers\n";
if ( $instance_manager->{'pid'} )
{
print "Shutting-down Instance Manager\n";
im_stop($instance_manager, "stop_all_servers");
}
mtr_im_stop($instance_manager, "stop_all_servers");
my %admin_pids; # hash of admin processes that requests shutdown
my @kill_pids; # list of processes to shutdown/kill
......@@ -3332,7 +3323,7 @@ sub run_testcase_start_servers($) {
im_create_defaults_file($instance_manager);
im_start($instance_manager, $tinfo->{im_opts});
mtr_im_start($instance_manager, $tinfo->{im_opts});
}
# ----------------------------------------------------------------------
......@@ -3396,236 +3387,6 @@ sub run_testcase_start_servers($) {
}
}
##############################################################################
#
# Instance Manager management routines.
#
##############################################################################
sub im_start($$) {
my $instance_manager = shift;
my $opts = shift;
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--defaults-file=%s",
$instance_manager->{'defaults_file'});
if ( $opt_debug )
{
mtr_add_arg($args, "--debug=d:t:i:A,%s/log/im.trace",
$opt_vardir_trace);
}
foreach my $opt (@{$opts})
{
mtr_add_arg($args, $opt);
}
$instance_manager->{'pid'} =
mtr_spawn(
$exe_im, # path to the executable
$args, # cmd-line args
'', # stdin
$instance_manager->{'path_log'}, # stdout
$instance_manager->{'path_err'}, # stderr
'', # pid file path (not used)
{ append_log_file => 1 } # append log files
);
if ( ! $instance_manager->{'pid'} )
{
mtr_report('Could not start Instance Manager');
return;
}
# Instance Manager can be run in daemon mode. In this case, it creates
# several processes and the parent process, created by mtr_spawn(), exits just
# after start. So, we have to obtain Instance Manager PID from the PID file.
if ( ! sleep_until_file_created(
$instance_manager->{'path_pid'},
$instance_manager->{'start_timeout'},
-1)) # real PID is still unknown
{
mtr_report("Instance Manager PID file is missing");
return;
}
my $pid= mtr_get_pid_from_file($instance_manager->{'path_pid'});
$instance_manager->{'pid'} = $pid;
mtr_verbose("im_start: pid: $pid");
}
sub im_stop($$) {
my $instance_manager = shift;
my $where = shift;
# Obtain mysqld-process pids before we start stopping IM (it can delete pid
# files).
my @mysqld_pids = ();
my $instances = $instance_manager->{'instances'};
push(@mysqld_pids, mtr_get_pid_from_file($instances->[0]->{'path_pid'}))
if -r $instances->[0]->{'path_pid'};
push(@mysqld_pids, mtr_get_pid_from_file($instances->[1]->{'path_pid'}))
if -r $instances->[1]->{'path_pid'};
# Re-read pid from the file, since during tests Instance Manager could have
# been restarted, so its pid could have been changed.
$instance_manager->{'pid'} =
mtr_get_pid_from_file($instance_manager->{'path_pid'})
if -f $instance_manager->{'path_pid'};
if (-f $instance_manager->{'path_angel_pid'})
{
$instance_manager->{'angel_pid'} =
mtr_get_pid_from_file($instance_manager->{'path_angel_pid'})
}
else
{
$instance_manager->{'angel_pid'} = undef;
}
# Inspired from mtr_stop_mysqld_servers().
start_reap_all();
# Try graceful shutdown.
mtr_verbose("Stopping IM-main, pid: $instance_manager->{'pid'}");
mtr_kill_process($instance_manager->{'pid'}, 'TERM', 10);
# If necessary, wait for angel process to die.
my $pid= $instance_manager->{'angel_pid'};
if (defined $pid)
{
mtr_verbose("Waiting for IM-angel to die, pid: $pid");
my $total_attempts= 10;
for (my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt)
{
unless (kill (0, $pid))
{
mtr_verbose("IM-angel died.");
last;
}
sleep(1);
}
}
# Check if all processes shutdown cleanly
my $clean_shutdown= 0;
while (1)
{
# Check that IM-main died.
if (kill (0, $instance_manager->{'pid'}))
{
mtr_debug("IM-main is still alive.");
last;
}
# Check that IM-angel died.
if (defined $instance_manager->{'angel_pid'} &&
kill (0, $instance_manager->{'angel_pid'}))
{
mtr_debug("IM-angel is still alive.");
last;
}
# Check that all guarded mysqld-instances died.
my $guarded_mysqlds_dead= 1;
foreach my $pid (@mysqld_pids)
{
if (kill (0, $pid))
{
mtr_debug("Guarded mysqld ($pid) is still alive.");
$guarded_mysqlds_dead= 0;
last;
}
}
last unless $guarded_mysqlds_dead;
# Ok, all necessary processes are dead.
$clean_shutdown= 1;
last;
}
# Kill leftovers (the order is important).
if ($clean_shutdown)
{
mtr_debug("IM-shutdown was clean -- all processed died.");
}
else
{
mtr_debug("IM failed to shutdown gracefully. We have to clean the mess...");
}
unless ($clean_shutdown)
{
if (defined $instance_manager->{'angel_pid'})
{
mtr_verbose("Killing IM-angel, pid: $instance_manager->{'angel_pid'}");
mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10)
}
mtr_verbose("Killing IM-main, pid: $instance_manager->{'pid'}");
mtr_kill_process($instance_manager->{'pid'}, 'KILL', 10);
# Shutdown managed mysqld-processes. Some of them may be nonguarded, so IM
# will not stop them on shutdown. So, we should firstly try to end them
# legally.
mtr_verbose("Killing guarded mysqld(s) " . join(" ", @mysqld_pids));
mtr_kill_processes(\@mysqld_pids);
# Complain in error log so that a warning will be shown.
#
# TODO: unless BUG#20761 is fixed, we will print the warning
# to stdout, so that it can be seen on console and does not
# produce pushbuild error.
# my $errlog= "$opt_vardir/log/mysql-test-run.pl.err";
#
# open (ERRLOG, ">>$errlog") ||
# mtr_error("Can not open error log ($errlog)");
#
# my $ts= localtime();
# print ERRLOG
# "Warning: [$ts] Instance Manager did not shutdown gracefully.\n";
#
# close ERRLOG;
my $ts= localtime();
print "[$where] Warning: [$ts] Instance Manager did not shutdown gracefully.\n";
}
# That's all.
stop_reap_all();
$instance_manager->{'pid'} = undef;
$instance_manager->{'angel_pid'} = undef;
}
#
# Run include/check-testcase.test
# Before a testcase, run in record mode, save result file to var
......
......@@ -945,6 +945,31 @@ DROP TABLE mysqltest3.t_nn;
DROP DATABASE mysqltest3;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost';
DROP USER 'mysqltest_1'@'localhost';
use test;
create user mysqltest1_thisisreallytoolong;
ERROR HY000: Operation CREATE USER failed for 'mysqltest1_thisisreallytoolong'@'%'
ERROR HY000: String 'mysqltest1_thisisreallytoolong' is too long for user name (should be no longer than 16)
GRANT CREATE ON mysqltest.* TO 1234567890abcdefGHIKL@localhost;
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
GRANT CREATE ON mysqltest.* TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
REVOKE CREATE ON mysqltest.* FROM 1234567890abcdefGHIKL@localhost;
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
REVOKE CREATE ON mysqltest.* FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
GRANT CREATE ON t1 TO 1234567890abcdefGHIKL@localhost;
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
GRANT CREATE ON t1 TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
REVOKE CREATE ON t1 FROM 1234567890abcdefGHIKL@localhost;
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
REVOKE CREATE ON t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
GRANT EXECUTE ON PROCEDURE p1 TO 1234567890abcdefGHIKL@localhost;
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
GRANT EXECUTE ON PROCEDURE p1 TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
REVOKE EXECUTE ON PROCEDURE p1 FROM 1234567890abcdefGHIKL@localhost;
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
REVOKE EXECUTE ON PROCEDURE t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
End of 5.0 tests
SHOW VARIABLES LIKE 'server_id';
Variable_name Value
server_id 1
SHOW INSTANCES;
instance_name state
mysqld1 starting
mysqld2 offline
--> Listing users...
im_admin
......
--------------------------------------------------------------------
server_id = 1
server_id = 2
--------------------------------------------------------------------
SHOW VARIABLES LIKE 'server_id';
Variable_name Value
server_id 1
SHOW INSTANCES;
instance_name state
mysqld1 online
mysqld2 offline
---> connection: mysql1_con
SHOW VARIABLES LIKE 'server_id';
Variable_name Value
server_id 1
---> connection: default
--------------------------------------------------------------------
server_id = 1
server_id = 2
--------------------------------------------------------------------
CREATE INSTANCE mysqld3
server_id = 3,
socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
......
......@@ -4872,8 +4872,6 @@ declare continue handler for sqlexception begin end;
select no_such_function();
end|
call bug18787()|
no_such_function()
NULL
drop procedure bug18787|
create database bug18344_012345678901|
use bug18344_012345678901|
......@@ -5223,20 +5221,125 @@ greek greek_general_ci
use test|
DROP DATABASE mysqltest1|
drop table if exists t3|
drop database if exists mysqltest1|
drop table if exists t4|
drop procedure if exists bug8153_subselect|
drop procedure if exists bug8153_subselect_a|
drop procedure if exists bug8153_subselect_b|
drop procedure if exists bug8153_proc_a|
drop procedure if exists bug8153_proc_b|
create table t3 (a int)|
insert into t3 (a) values (1), (2)|
create database mysqltest1|
use mysqltest1|
drop database mysqltest1|
select database()|
database()
NULL
select * from (select 1 as a) as t1 natural join (select * from test.t3) as t2|
create table t4 (a int)|
insert into t3 values (1), (1), (2), (3)|
insert into t4 values (1), (1)|
create procedure bug8153_subselect()
begin
declare continue handler for sqlexception
begin
select 'statement failed';
end;
update t3 set a=a+1 where (select a from t4 where a=1) is null;
select 'statement after update';
end|
call bug8153_subselect()|
statement failed
statement failed
statement after update
statement after update
select * from t3|
a
1
use test|
1
2
3
call bug8153_subselect()|
statement failed
statement failed
statement after update
statement after update
select * from t3|
a
1
1
2
3
drop procedure bug8153_subselect|
create procedure bug8153_subselect_a()
begin
declare continue handler for sqlexception
begin
select 'in continue handler';
end;
select 'reachable code a1';
call bug8153_subselect_b();
select 'reachable code a2';
end|
create procedure bug8153_subselect_b()
begin
select 'reachable code b1';
update t3 set a=a+1 where (select a from t4 where a=1) is null;
select 'unreachable code b2';
end|
call bug8153_subselect_a()|
reachable code a1
reachable code a1
reachable code b1
reachable code b1
in continue handler
in continue handler
reachable code a2
reachable code a2
select * from t3|
a
1
1
2
3
call bug8153_subselect_a()|
reachable code a1
reachable code a1
reachable code b1
reachable code b1
in continue handler
in continue handler
reachable code a2
reachable code a2
select * from t3|
a
1
1
2
3
drop procedure bug8153_subselect_a|
drop procedure bug8153_subselect_b|
create procedure bug8153_proc_a()
begin
declare continue handler for sqlexception
begin
select 'in continue handler';
end;
select 'reachable code a1';
call bug8153_proc_b();
select 'reachable code a2';
end|
create procedure bug8153_proc_b()
begin
select 'reachable code b1';
select no_such_function();
select 'unreachable code b2';
end|
call bug8153_proc_a()|
reachable code a1
reachable code a1
reachable code b1
reachable code b1
in continue handler
in continue handler
reachable code a2
reachable code a2
drop procedure bug8153_proc_a|
drop procedure bug8153_proc_b|
drop table t3|
drop table t4|
drop procedure if exists bug19862|
CREATE TABLE t11 (a INT)|
CREATE TABLE t12 (a INT)|
......@@ -5256,5 +5359,25 @@ a
2
DROP TABLE t11, t12|
DROP FUNCTION bug19862|
DROP PROCEDURE IF EXISTS bug16899_p1|
DROP FUNCTION IF EXISTS bug16899_f1|
CREATE DEFINER=1234567890abcdefGHIKL@localhost PROCEDURE bug16899_p1()
BEGIN
SET @a = 1;
END|
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY
FUNCTION bug16899_f1() RETURNS INT
BEGIN
RETURN 1;
END|
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
drop procedure if exists bug21416|
create procedure bug21416() show create procedure bug21416|
call bug21416()|
Procedure sql_mode Create Procedure
bug21416 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug21416`()
show create procedure bug21416
drop procedure bug21416|
End of 5.0 tests
drop table t1,t2;
......@@ -807,7 +807,8 @@ DROP DATABASE mysqltest3;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost';
DROP USER 'mysqltest_1'@'localhost';
# restore the original database
use test;
#
# Bug #10668: CREATE USER does not enforce username length limit
......
......@@ -4,7 +4,7 @@
#
###########################################################################
--source include/im_check_os.inc
--source include/im_check_env.inc
###########################################################################
......
......@@ -26,7 +26,7 @@
#
###########################################################################
--source include/im_check_os.inc
--source include/im_check_env.inc
###########################################################################
#
......@@ -40,29 +40,6 @@
--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
# Check that mysqld1 is reported as running.
--sleep 3
# should be longer than monitoring interval and enough to start instance.
SHOW INSTANCES;
# Check that the expected mysqld instance is actually run (check that we can
# connect and execute something).
--echo
--echo ---> connection: mysql1_con
--connect (mysql1_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
--connection mysql1_con
SHOW VARIABLES LIKE 'server_id';
--disconnect mysql1_con
--echo
--echo ---> connection: default
--connection default
###########################################################################
#
# CREATE INSTANCE tests.
......
......@@ -6302,7 +6302,7 @@ Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table,
{
Field *field;
if (type() != MYSQL_TYPE_VAR_STRING || keep_type)
new_field= Field::new_field(root, new_table, keep_type);
field= Field::new_field(root, new_table, keep_type);
else if ((field= new Field_varstring(field_length, maybe_null(), field_name,
new_table->s, charset())))
{
......@@ -6318,7 +6318,7 @@ Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table,
not applicable. But we still need to preserve the original field
metadata for the client-server protocol.
*/
new_field->orig_table= orig_table;
field->orig_table= orig_table;
}
return field;
}
......
......@@ -515,8 +515,8 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
which would be transformed to:
WHERE col= 'j'
*/
(*a)->walk(&Item::set_no_const_sub, (byte*) 0);
(*b)->walk(&Item::set_no_const_sub, (byte*) 0);
(*a)->walk(&Item::set_no_const_sub, FALSE, (byte*) 0);
(*b)->walk(&Item::set_no_const_sub, FALSE, (byte*) 0);
}
break;
}
......
......@@ -270,7 +270,6 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_CREATE_EVENT:
case SQLCOM_ALTER_EVENT:
case SQLCOM_DROP_EVENT:
case SQLCOM_FLUSH:
case SQLCOM_INSTALL_PLUGIN:
case SQLCOM_UNINSTALL_PLUGIN:
flags= sp_head::HAS_COMMIT_OR_ROLLBACK;
......
......@@ -118,7 +118,7 @@ class sp_head :private Query_arena
HAS_COMMIT_OR_ROLLBACK= 128,
LOG_SLOW_STATEMENTS= 256, // Used by events
LOG_GENERAL_LOG= 512, // Used by events
BINLOG_ROW_BASED_IF_MIXED= 1024
BINLOG_ROW_BASED_IF_MIXED= 1024,
HAS_SQLCOM_RESET= 2048,
HAS_SQLCOM_FLUSH= 4096
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment