1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-16 20:23:18 +03:00

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb
This commit is contained in:
tomas@poseidon.ndb.mysql.com
2006-05-04 21:55:12 +02:00
267 changed files with 14345 additions and 2655 deletions

View File

@@ -1,6 +1,13 @@
--exec test x$NDB_STATUS_OK = x1
# Check that server is compiled and started with support for NDB
-- require r/have_ndb.require
disable_query_log;
show variables like "have_ndbcluster";
enable_query_log;
# Check that NDB is installed and known to be working
-- require r/have_ndb_status_ok.require
disable_query_log;
eval select "$NDB_STATUS_OK" as ndb_status_ok;
enable_query_log;

View File

@@ -4,11 +4,13 @@
#
--require r/have_udf.require
disable_query_log;
show variables like "have_dlopen";
show variables like "have_dynamic_loading";
enable_query_log;
#
# Check that the "udf_example.so" file has been created
# Check if the variable UDF_EXAMPLE_LIB is set
#
# TODO
--require r/have_udf_example.require
disable_query_log;
eval select LENGTH("$UDF_EXAMPLE_LIB") > 0 as "have_udf_example_lib";
enable_query_log;

View File

@@ -0,0 +1,4 @@
-- require r/not_as_root.require
disable_query_log;
eval select "$MYSQL_TEST_ROOT" as running_as_root;
enable_query_log;

View File

@@ -12,6 +12,7 @@ sub mtr_init_args ($);
sub mtr_add_arg ($$@);
sub mtr_path_exists(@);
sub mtr_script_exists(@);
sub mtr_file_exists(@);
sub mtr_exe_exists(@);
sub mtr_copy_dir($$);
sub mtr_same_opts($$);
@@ -94,6 +95,14 @@ sub mtr_script_exists (@) {
}
}
sub mtr_file_exists (@) {
foreach my $path ( @_ )
{
return $path if -e $path;
}
return "";
}
sub mtr_exe_exists (@) {
my @path= @_;
map {$_.= ".exe"} @path if $::glob_win32;
@@ -111,18 +120,27 @@ sub mtr_exe_exists (@) {
}
}
sub mtr_copy_dir($$) {
my $srcdir= shift;
my $dstdir= shift;
my $from_dir= shift;
my $to_dir= shift;
mkpath("$to_dir");
opendir(DIR, "$from_dir")
or mtr_error("Can't find $from_dir$!");
for(readdir(DIR)) {
next if "$_" eq "." or "$_" eq "..";
if ( -d "$from_dir/$_" )
{
mtr_copy_dir("$from_dir/$_", "$to_dir/$_");
next;
}
copy("$from_dir/$_", "$to_dir/$_");
}
closedir(DIR);
# Create destination directory
mkpath($dstdir);
find(\&mtr_copy_one_file, $dstdir);
}
sub mtr_copy_one_file {
print $File::Find::name, "\n";
}
sub mtr_same_opts ($$) {
my $l1= shift;

View File

@@ -672,12 +672,15 @@ sub mtr_mysqladmin_shutdown {
# Shutdown time must be high as slave may be in reconnect
mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo");
mtr_add_arg($args, "shutdown");
my $path_mysqladmin_log= "$::opt_vardir/log/mysqladmin.log";
# Start mysqladmin in paralell and wait for termination later
my $pid= mtr_spawn($::exe_mysqladmin, $args,
"", $::path_manager_log, $::path_manager_log, "",
"", $path_mysqladmin_log, $path_mysqladmin_log, "",
{ append_log_file => 1 });
# Save the pid of the mysqladmin process
$mysql_admin_pids{$pid}= 1;
# We don't wait for termination of mysqladmin
}
# Wait for all the started mysqladmin to exit
@@ -720,8 +723,6 @@ sub mtr_mysqladmin_shutdown {
$timeout or mtr_debug("At least one server is still listening to its port");
sleep(5) if $::glob_win32; # FIXME next startup fails if no sleep
return $res;
}
@@ -821,8 +822,10 @@ sub sleep_until_file_created ($$$) {
my $pidfile= shift;
my $timeout= shift;
my $pid= shift;
my $sleeptime= 100; # Milliseconds
my $loops= ($timeout * 1000) / $sleeptime;
for ( my $loop= 1; $loop <= $timeout; $loop++ )
for ( my $loop= 1; $loop <= $loops; $loop++ )
{
if ( -r $pidfile )
{
@@ -835,16 +838,20 @@ sub sleep_until_file_created ($$$) {
return 0;
}
mtr_debug("Sleep 1 second waiting for creation of $pidfile");
mtr_debug("Sleep $sleeptime milliseconds waiting for ".
"creation of $pidfile");
if ( $loop % 60 == 0 )
# Print extra message every 60 seconds
my $seconds= ($loop * $sleeptime) / 1000;
if ( $seconds > 1 and $seconds % 60 == 0 )
{
my $left= $timeout - $loop;
mtr_warning("Waited $loop seconds for $pidfile to be created, " .
my $left= $timeout - $seconds;
mtr_warning("Waited $seconds seconds for $pidfile to be created, " .
"still waiting for $left seconds...");
}
sleep(1);
# Millisceond sleep emulated with select
select(undef, undef, undef, ($sleeptime/1000));
}
return 0;

View File

@@ -158,9 +158,9 @@ our $path_client_bindir;
our $path_language;
our $path_timefile;
our $path_snapshot;
our $path_manager_log; # Used by mysqldadmin
our $path_slave_load_tmpdir; # What is this?!
our $path_mysqltest_log;
our $path_current_test_log;
our $path_my_basedir;
our $opt_vardir; # A path but set directly on cmd line
our $opt_vardir_trace; # unix formatted opt_vardir for trace files
@@ -191,6 +191,7 @@ our $exe_mysqltest;
our $exe_slave_mysqld;
our $exe_im;
our $exe_my_print_defaults;
our $lib_udf_example;
our $opt_bench= 0;
our $opt_small_bench= 0;
@@ -207,7 +208,6 @@ our $opt_sp_protocol;
our $opt_cursor_protocol;
our $opt_view_protocol;
our $opt_current_test;
our $opt_debug;
our $opt_do_test;
our @opt_cases; # The test cases names in argv
@@ -250,9 +250,6 @@ our $opt_ndbconnectstring;
our $opt_ndbcluster_port_slave;
our $opt_ndbconnectstring_slave;
our $opt_no_manager; # Does nothing now, we never use manager
our $opt_manager_port; # Does nothing now, we never use manager
our $opt_old_master;
our $opt_record;
@@ -262,6 +259,7 @@ our $opt_result_ext;
our $opt_skip;
our $opt_skip_rpl;
our $use_slaves;
our $opt_skip_test;
our $opt_skip_im;
@@ -343,11 +341,13 @@ our @data_dir_lst;
sub main ();
sub initial_setup ();
sub command_line_setup ();
sub snapshot_setup ();
sub executable_setup ();
sub environment_setup ();
sub kill_running_server ();
sub kill_and_cleanup ();
sub check_ssl_support ();
sub check_running_as_root();
sub check_ndbcluster_support ();
sub rm_ndbcluster_tables ($);
sub ndbcluster_install ();
@@ -357,7 +357,7 @@ sub ndbcluster_install_slave ();
sub ndbcluster_start_slave ($);
sub ndbcluster_stop_slave ();
sub run_benchmarks ($);
sub run_tests ();
sub initialize_servers ();
sub mysql_install_db ();
sub install_db ($$);
sub run_testcase ($);
@@ -388,8 +388,9 @@ sub main () {
command_line_setup();
executable_setup();
check_ndbcluster_support();
check_ndbcluster_support(); # We check whether to actually use it later
check_ssl_support();
check_running_as_root();
environment_setup();
signal_setup();
@@ -404,49 +405,37 @@ sub main () {
gprof_prepare();
}
if ( ! $glob_use_running_server )
{
if ( $opt_start_dirty )
{
kill_running_server();
}
else
{
kill_and_cleanup();
mysql_install_db();
if ( $opt_force )
{
save_installed_db();
}
}
}
if ( $opt_start_dirty )
{
if ( ndbcluster_start($opt_with_ndbcluster) )
{
mtr_error("Can't start ndbcluster");
}
if ( mysqld_start('master',0,[],[],$using_ndbcluster_master) )
{
mtr_report("Servers started, exiting");
}
else
{
mtr_error("Can't start the mysqld server");
}
}
elsif ( $opt_bench )
if ( $opt_bench )
{
initialize_servers();
run_benchmarks(shift); # Shift what? Extra arguments?!
}
elsif ( $opt_stress )
{
initialize_servers();
run_stress_test()
}
else
{
run_tests();
# Figure out which tests we are going to run
my $tests= collect_test_cases($opt_suite);
# Turn off NDB and other similar options if no tests use it
my ($need_ndbcluster,$need_im);
foreach my $test (@$tests)
{
$need_ndbcluster||= $test->{ndb_test};
$need_im||= $test->{component_id} eq 'im';
$use_slaves||= $test->{slave_num};
}
$opt_with_ndbcluster= $opt_with_ndbcluster_slave= 0
unless $need_ndbcluster;
$opt_skip_im= 1 unless $need_im;
snapshot_setup();
initialize_servers();
run_suite($opt_suite, $tests);
}
mtr_exit(0);
@@ -589,7 +578,6 @@ sub command_line_setup () {
'compress' => \$opt_compress,
'bench' => \$opt_bench,
'small-bench' => \$opt_small_bench,
'no-manager' => \$opt_no_manager, # Currently not used
# Control what test suites or cases to run
'force' => \$opt_force,
@@ -616,7 +604,6 @@ sub command_line_setup () {
'slave_port=i' => \$opt_slave_myport,
'ndbcluster-port|ndbcluster_port=i' => \$opt_ndbcluster_port,
'ndbcluster-port-slave=i' => \$opt_ndbcluster_port_slave,
'manager-port=i' => \$opt_manager_port, # Currently not used
'im-port=i' => \$im_port, # Instance Manager port.
'im-mysqld1-port=i' => \$im_mysqld1_port, # Port of mysqld, controlled by IM
'im-mysqld2-port=i' => \$im_mysqld2_port, # Port of mysqld, controlled by IM
@@ -750,11 +737,6 @@ sub command_line_setup () {
$opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir;
$opt_tmpdir =~ s,/+$,,; # Remove ending slash if any
# FIXME maybe not needed?
$path_manager_log= "$opt_vardir/log/manager.log"
unless $path_manager_log;
$opt_current_test= "$opt_vardir/log/current_test"
unless $opt_current_test;
# --------------------------------------------------------------------------
# Do sanity checks of command line arguments
@@ -994,22 +976,32 @@ sub command_line_setup () {
$path_timefile= "$opt_vardir/log/mysqltest-time";
$path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
$path_current_test_log= "$opt_vardir/log/current_test";
$path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/";
}
sub snapshot_setup () {
# Make a list of all data_dirs
@data_dir_lst = (
$master->[0]->{'path_myddir'},
$master->[1]->{'path_myddir'},
$slave->[0]->{'path_myddir'},
$slave->[1]->{'path_myddir'},
$slave->[2]->{'path_myddir'});
$master->[1]->{'path_myddir'});
foreach my $instance (@{$instance_manager->{'instances'}})
if ($use_slaves)
{
push(@data_dir_lst, $instance->{'path_datadir'});
push @data_dir_lst, ($slave->[0]->{'path_myddir'},
$slave->[1]->{'path_myddir'},
$slave->[2]->{'path_myddir'});
}
unless ($opt_skip_im)
{
foreach my $instance (@{$instance_manager->{'instances'}})
{
push(@data_dir_lst, $instance->{'path_datadir'});
}
}
}
@@ -1091,6 +1083,8 @@ sub executable_setup () {
"/usr/bin/false");
$path_ndb_tools_dir= mtr_path_exists("$glob_basedir/storage/ndb/tools");
$exe_ndb_mgm= "$glob_basedir/storage/ndb/src/mgmclient/ndb_mgm";
$lib_udf_example=
mtr_file_exists("$glob_basedir/sql/.libs/udf_example.so");
}
else
{
@@ -1188,7 +1182,7 @@ sub environment_setup () {
# Add the path where mysqld will find udf_example.so
# --------------------------------------------------------------------------
$ENV{'LD_LIBRARY_PATH'}=
"$glob_basedir/sql/.libs" .
($lib_udf_example ? dirname($lib_udf_example) : "") .
($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
@@ -1215,6 +1209,7 @@ sub environment_setup () {
$ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port;
$ENV{'NDBCLUSTER_PORT_SLAVE'}=$opt_ndbcluster_port_slave;
$ENV{'NDB_STATUS_OK'}= "YES";
$ENV{'IM_PATH_PID'}= $instance_manager->{path_pid};
$ENV{'IM_PORT'}= $instance_manager->{port};
@@ -1254,6 +1249,7 @@ sub signal_setup () {
$SIG{INT}= \&handle_int_signal;
}
sub handle_int_signal () {
$SIG{INT}= 'DEFAULT'; # If we get a ^C again, we die...
mtr_warning("got INT signal, cleaning up.....");
@@ -1373,6 +1369,33 @@ sub kill_and_cleanup () {
}
sub check_running_as_root () {
# Check if running as root
# i.e a file can be read regardless what mode we set it to
my $test_file= "test_running_as_root.txt";
mtr_tofile($test_file, "MySQL");
chmod(oct("0000"), $test_file);
my $result="";
if (open(FILE,"<",$test_file))
{
$result= join('', <FILE>);
close FILE;
}
chmod(oct("0755"), $test_file);
unlink($test_file);
$ENV{'MYSQL_TEST_ROOT'}= "NO";
if ($result eq "MySQL")
{
mtr_warning("running this script as _root_ will cause some " .
"tests to be skipped");
$ENV{'MYSQL_TEST_ROOT'}= "YES";
}
}
sub check_ssl_support () {
@@ -1440,7 +1463,7 @@ sub check_ndbcluster_support () {
return;
}
mtr_report("Using ndbcluster, mysqld supports it");
mtr_report("Using ndbcluster if necessary, mysqld supports it");
$opt_with_ndbcluster= 1;
if ( $opt_ndbconnectstring )
{
@@ -1471,7 +1494,6 @@ sub check_ndbcluster_support () {
return;
}
# FIXME why is there a different start below?!
sub ndbcluster_install () {
@@ -1501,6 +1523,7 @@ sub ndbcluster_install () {
return 0;
}
sub ndbcluster_start ($) {
my $use_ndbcluster= shift;
@@ -1728,12 +1751,9 @@ sub run_benchmarks ($) {
# FIXME how to specify several suites to run? Comma separated list?
sub run_tests () {
run_suite($opt_suite);
}
sub run_suite () {
my $suite= shift;
my ($suite, $tests)= @_;
mtr_print_thick_line();
@@ -1741,8 +1761,6 @@ sub run_suite () {
mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout);
my $tests= collect_test_cases($suite);
mtr_report("Starting Tests in the '$suite' suite");
mtr_print_header();
@@ -1784,14 +1802,37 @@ sub run_suite () {
#
##############################################################################
sub initialize_servers () {
if ( ! $glob_use_running_server )
{
if ( $opt_start_dirty )
{
kill_running_server();
}
else
{
kill_and_cleanup();
mysql_install_db();
if ( $opt_force )
{
save_installed_db();
}
}
}
}
sub mysql_install_db () {
# FIXME not exactly true I think, needs improvements
install_db('master', $master->[0]->{'path_myddir'});
install_db('master', $master->[1]->{'path_myddir'});
install_db('slave', $slave->[0]->{'path_myddir'});
install_db('slave', $slave->[1]->{'path_myddir'});
install_db('slave', $slave->[2]->{'path_myddir'});
if ( $use_slaves )
{
install_db('slave', $slave->[0]->{'path_myddir'});
install_db('slave', $slave->[1]->{'path_myddir'});
install_db('slave', $slave->[2]->{'path_myddir'});
}
if ( ! $opt_skip_im )
{
@@ -1806,6 +1847,7 @@ sub mysql_install_db () {
mtr_report("ndbcluster_install failed, continuing without cluster");
$opt_with_ndbcluster= 0;
$flag_ndb_status_ok= 0;
$ENV{'NDB_STATUS_OK'}= "NO";
}
else
{
@@ -1845,7 +1887,7 @@ sub install_db ($$) {
my $init_db_sql_tmp= "/tmp/init_db.sql$$";
my $args;
mtr_report("Installing \u$type Databases");
mtr_report("Installing \u$type Database");
open(IN, $init_db_sql)
or mtr_error("Can't open $init_db_sql: $!");
@@ -1889,8 +1931,15 @@ sub install_db ($$) {
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
}
# Log bootstrap command
my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log";
mtr_tofile($path_bootstrap_log,
"$exe_mysqld " . join(" ", @$args) . "\n");
if ( mtr_run($exe_mysqld, $args, $init_db_sql_tmp,
$path_manager_log, $path_manager_log, "") != 0 )
$path_bootstrap_log, $path_bootstrap_log,
"", { append_log_file => 1 }) != 0 )
{
unlink($init_db_sql_tmp);
mtr_error("Error executing mysqld --bootstrap\n" .
@@ -1912,15 +1961,15 @@ sub im_create_passwd_file($) {
my $instance_manager = shift;
my $pwd_file_path = $instance_manager->{'password_file'};
mtr_report("Creating IM password file ($pwd_file_path)");
open(OUT, ">", $pwd_file_path)
or mtr_error("Can't write to $pwd_file_path: $!");
print OUT $instance_manager->{'admin_login'}, ":",
$instance_manager->{'admin_sha1'}, "\n";
close(OUT);
}
@@ -1932,7 +1981,7 @@ sub im_create_defaults_file($) {
open(OUT, ">", $defaults_file)
or mtr_error("Can't write to $defaults_file: $!");
print OUT <<EOF
[mysql]
@@ -2014,7 +2063,7 @@ sub run_testcase ($) {
my $ndbcluster_opt;
mtr_tonewfile($opt_current_test,"$tname\n"); # Always tell where we are
mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are
# output current test to ndbcluster log file to enable diagnostics
mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n");
@@ -2093,7 +2142,7 @@ sub run_testcase ($) {
# ----------------------------------------------------------------------
stop_slaves();
}
}
# ----------------------------------------------------------------------
# Prepare to start masters. Even if we use embedded, we want to run
@@ -2110,9 +2159,9 @@ sub run_testcase ($) {
mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
}
# FIXME test cases that depend on each other, prevent this from
# being at this location.
# do_before_start_master($tname,$tinfo->{'master_sh'});
# FIXME test cases that depend on each other, prevent this from
# being at this location.
# do_before_start_master($tname,$tinfo->{'master_sh'});
# ----------------------------------------------------------------------
# If any mysqld servers running died, we have to know
@@ -2243,10 +2292,11 @@ sub run_testcase ($) {
}
# ----------------------------------------------------------------------
# If --start-and-exit given, stop here to let user manually run tests
# If --start-and-exit or --start-dirty given, stop here to let user manually
# run tests
# ----------------------------------------------------------------------
if ( $opt_start_and_exit )
if ( $opt_start_and_exit or $opt_start_dirty )
{
mtr_report("\nServers started, exiting");
exit(0);
@@ -2312,25 +2362,6 @@ sub run_testcase ($) {
}
}
sub copy_dir($$) {
my $from_dir= shift;
my $to_dir= shift;
mkpath("$to_dir");
opendir(DIR, "$from_dir")
or mtr_error("Can't find $from_dir$!");
for(readdir(DIR)) {
next if "$_" eq "." or "$_" eq "..";
if ( -d "$from_dir/$_" )
{
copy_dir("$from_dir/$_", "$to_dir/$_");
next;
}
copy("$from_dir/$_", "$to_dir/$_");
}
closedir(DIR);
}
#
# Save a snapshot of the installed test db(s)
@@ -2344,7 +2375,7 @@ sub save_installed_db () {
foreach my $data_dir (@data_dir_lst)
{
my $name= basename($data_dir);
copy_dir("$data_dir", "$path_snapshot/$name");
mtr_copy_dir("$data_dir", "$path_snapshot/$name");
}
}
@@ -2368,6 +2399,7 @@ sub save_files_before_restore($$) {
}
}
#
# Restore snapshot of the installed test db(s)
# if the snapshot exists
@@ -2386,7 +2418,7 @@ sub restore_installed_db ($) {
my $name= basename($data_dir);
save_files_before_restore($test_name, $data_dir);
rmtree("$data_dir");
copy_dir("$path_snapshot/$name", "$data_dir");
mtr_copy_dir("$path_snapshot/$name", "$data_dir");
}
if ($opt_with_ndbcluster)
{
@@ -2443,9 +2475,9 @@ sub report_failure_and_restart ($) {
#
##############################################################################
# The embedded server needs the cleanup so we do some of the start work
# but stop before actually running mysqld or anything.
sub do_before_start_master ($$) {
my $tname= shift;
my $init_script= shift;
@@ -2478,13 +2510,14 @@ sub do_before_start_master ($$) {
if ( $ret != 0 )
{
# FIXME rewrite those scripts to return 0 if successful
# mtr_warning("$init_script exited with code $ret");
# mtr_warning("$init_script exited with code $ret");
}
}
# for gcov FIXME needed? If so we need more absolute paths
# chdir($glob_basedir);
# chdir($glob_basedir);
}
sub do_before_start_slave ($$) {
my $tname= shift;
my $init_script= shift;
@@ -2512,7 +2545,7 @@ sub do_before_start_slave ($$) {
if ( $ret != 0 )
{
# FIXME rewrite those scripts to return 0 if successful
# mtr_warning("$init_script exited with code $ret");
# mtr_warning("$init_script exited with code $ret");
}
}
@@ -2522,6 +2555,7 @@ sub do_before_start_slave ($$) {
}
}
sub mysqld_arguments ($$$$$$) {
my $args= shift;
my $type= shift; # master/slave/bootstrap
@@ -2766,14 +2800,6 @@ sub mysqld_arguments ($$$$$$) {
return $args;
}
# FIXME
# if ( $type eq 'master' and $glob_use_embedded_server )
# {
# # Add a -A to each argument to pass it to embedded server
# my @mysqltest_opt= map {("-A",$_)} @args;
# $opt_extra_mysqltest_opt= \@mysqltest_opt;
# return;
# }
##############################################################################
#
@@ -2873,6 +2899,7 @@ sub mysqld_start ($$$$$) {
return 0;
}
sub stop_masters_slaves () {
print "Ending Tests\n";
@@ -2882,7 +2909,7 @@ sub stop_masters_slaves () {
print "Shutting-down Instance Manager\n";
im_stop($instance_manager);
}
print "Shutting-down MySQL daemon\n\n";
stop_masters();
print "Master(s) shutdown finished\n";
@@ -2890,6 +2917,7 @@ sub stop_masters_slaves () {
print "Slave(s) shutdown finished\n";
}
sub stop_masters () {
my @args;
@@ -2919,6 +2947,7 @@ sub stop_masters () {
mtr_stop_mysqld_servers(\@args);
}
sub stop_slaves () {
my $force= shift;
@@ -2973,7 +3002,7 @@ sub im_start($$) {
mtr_add_arg($args, $opt);
}
$instance_manager->{'pid'} =
$instance_manager->{'pid'} =
mtr_spawn(
$exe_im, # path to the executable
$args, # cmd-line args
@@ -2989,7 +3018,7 @@ sub im_start($$) {
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.
@@ -3007,6 +3036,7 @@ sub im_start($$) {
mtr_get_pid_from_file($instance_manager->{'path_pid'});
}
sub im_stop($) {
my $instance_manager = shift;
@@ -3041,12 +3071,13 @@ sub im_stop($) {
# Kill processes.
mtr_kill_processes(\@pids);
stop_reap_all();
$instance_manager->{'pid'} = undef;
}
#
# Run include/check-testcase.test
# Before a testcase, run in record mode, save result file to var
@@ -3095,6 +3126,7 @@ sub run_check_testcase ($) {
}
}
sub run_mysqltest ($) {
my $tinfo= shift;
@@ -3188,11 +3220,6 @@ sub run_mysqltest ($) {
"--port=$master->[0]->{'path_myport'} " .
"--socket=$master->[0]->{'path_mysock'}";
# FIXME really needing a PATH???
# $ENV{'PATH'}= "/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$ENV{'PATH'}";
$ENV{'MYSQL'}= $cmdline_mysql;
$ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck;
$ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
@@ -3205,9 +3232,11 @@ sub run_mysqltest ($) {
$ENV{'MYSQL_CLIENT_TEST'}= $cmdline_mysql_client_test;
$ENV{'CHARSETSDIR'}= $path_charsetsdir;
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults;
$ENV{'UDF_EXAMPLE_LIB'}=
($lib_udf_example ? basename($lib_udf_example) : "");
$ENV{'NDB_STATUS_OK'}= $flag_ndb_status_ok;
$ENV{'NDB_SLAVE_STATUS_OK'}= $flag_ndb_slave_status_ok;
$ENV{'NDB_STATUS_OK'}= $flag_ndb_status_ok ? "YES" : "NO";
$ENV{'NDB_SLAVE_STATUS_OK'}= $flag_ndb_slave_status_ok ? "YES" : "NO";
$ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test;
$ENV{'NDB_MGM'}= $exe_ndb_mgm;
$ENV{'NDB_BACKUP_DIR'}= $path_ndb_data_dir;
@@ -3460,6 +3489,7 @@ sub gdb_arguments {
$$exe= "xterm";
}
#
# Modify the exe and args so that program is run in ddd
#
@@ -3491,8 +3521,7 @@ sub ddd_arguments {
"break mysql_parse\n" .
"commands 1\n" .
"disable 1\n" .
"end\n" .
"run");
"end");
}
if ( $opt_manual_ddd )
@@ -3700,11 +3729,12 @@ Misc options
comment=STR Write STR to the output
notimer Don't show test case execution time
script-debug Debug this script itself
start-and-exit Only initiate and start the "mysqld" servers, use
the startup settings for the specified test case if any
start-dirty Only start the "mysqld" servers without initiation
fast Don't try to cleanup from earlier runs
reorder Reorder tests to get less server restarts
start-and-exit Only initialize and start the servers, using the
startup settings for the specified test case (if any)
start-dirty Only start the servers (without initialization) for
the specified test case (if any)
fast Don't try to clean up from earlier runs
reorder Reorder tests to get fewer server restarts
help Get this help text
unified-diff | udiff When presenting differences, use unified diff

View File

@@ -264,7 +264,7 @@ done
# test if Ndb Cluster starts properly
if [ `expr $VERBOSE \> 1` = 1 ] ; then
echo "Waiting for started..."
echo "Waiting for NDB data nodes to start..."
fi
if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK" > /dev/null 2>&1 ; then :; else
if [ `expr $VERBOSE \> 0` = 1 ] ; then

View File

@@ -28,3 +28,4 @@ select * from t1 ignore index (primary) where tt like 'AA%';
id tt
select * from t1 where tt like '%AA%';
id tt
drop table t1;

View File

@@ -355,3 +355,17 @@ insert into mysql.user select * from t1;
drop table t1, t2;
drop database TESTDB;
flush privileges;
grant all privileges on test.* to `a@`@localhost;
grant execute on * to `a@`@localhost;
create table t2 (s1 int);
insert into t2 values (1);
drop function if exists f2;
create function f2 () returns int begin declare v int; select s1 from t2
into v; return v; end//
select f2();
f2()
1
drop function f2;
drop table t2;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
drop user `a@`@localhost;

View File

@@ -0,0 +1,2 @@
ndb_status_ok
YES

View File

@@ -1,2 +1,2 @@
Variable_name Value
have_dlopen YES
have_dynamic_loading YES

View File

@@ -0,0 +1,2 @@
have_udf_example_lib
1

View File

@@ -392,3 +392,16 @@ HAVING HU.PROJ.CITY = HU.STAFF.CITY);
EMPNUM GRADE*1000
E3 13000
DROP SCHEMA HU;
USE test;
create table t1(f1 int);
select f1 from t1 having max(f1)=f1;
f1
select f1 from t1 group by f1 having max(f1)=f1;
f1
set session sql_mode='ONLY_FULL_GROUP_BY';
select f1 from t1 having max(f1)=f1;
ERROR 42000: non-grouping field 'f1' is used in HAVING clause
select f1 from t1 group by f1 having max(f1)=f1;
f1
set session sql_mode='';
drop table t1;

View File

@@ -50,6 +50,7 @@ KEY_COLUMN_USAGE
PARTITIONS
PLUGINS
PROCESSLIST
REFERENTIAL_CONSTRAINTS
ROUTINES
SCHEMATA
SCHEMA_PRIVILEGES
@@ -745,7 +746,7 @@ CREATE TABLE t_crashme ( f1 BIGINT);
CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1;
CREATE VIEW a2 AS SELECT t_CRASHME FROM a1;
count(*)
112
113
drop view a2, a1;
drop table t_crashme;
select table_schema,table_name, column_name from
@@ -759,6 +760,7 @@ information_schema PARTITIONS PARTITION_EXPRESSION
information_schema PARTITIONS SUBPARTITION_EXPRESSION
information_schema PARTITIONS PARTITION_DESCRIPTION
information_schema PLUGINS PLUGIN_DESCRIPTION
information_schema PROCESSLIST INFO
information_schema ROUTINES ROUTINE_DEFINITION
information_schema ROUTINES SQL_MODE
information_schema TRIGGERS ACTION_CONDITION
@@ -832,6 +834,7 @@ COLUMN_PRIVILEGES TABLE_NAME select
FILES TABLE_NAME select
KEY_COLUMN_USAGE TABLE_NAME select
PARTITIONS TABLE_NAME select
REFERENTIAL_CONSTRAINTS TABLE_NAME select
STATISTICS TABLE_NAME select
TABLES TABLE_NAME select
TABLE_CONSTRAINTS TABLE_NAME select
@@ -843,7 +846,7 @@ flush privileges;
SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
table_schema count(*)
cluster 1
information_schema 22
information_schema 23
mysql 21
create table t1 (i int, j int);
create trigger trg1 before insert on t1 for each row

View File

@@ -13,6 +13,7 @@ KEY_COLUMN_USAGE
PARTITIONS
PLUGINS
PROCESSLIST
REFERENTIAL_CONSTRAINTS
ROUTINES
SCHEMATA
SCHEMA_PRIVILEGES

View File

@@ -25,3 +25,34 @@ NULL test PRIMARY NULL test t3 id 1 NULL NULL NULL NULL
NULL test t3_ibfk_1 NULL test t3 id 1 1 test t2 t1_id
NULL test t3_ibfk_1 NULL test t3 t2_id 2 2 test t2 id
drop table t3, t2, t1;
CREATE TABLE t1(a1 INT NOT NULL, a2 INT NOT NULL,
PRIMARY KEY(a1, a2)) ENGINE=INNODB;
CREATE TABLE t2(b1 INT, b2 INT, INDEX (b1, b2),
CONSTRAINT A1
FOREIGN KEY (b1, b2) REFERENCES t1(a1, a2)
ON UPDATE CASCADE ON DELETE NO ACTION) ENGINE=INNODB;
CREATE TABLE t3(b1 INT, b2 INT, INDEX (b1, b2),
CONSTRAINT A2
FOREIGN KEY (b1, b2) REFERENCES t2(b1, b2)
ON UPDATE SET NULL ON DELETE RESTRICT) ENGINE=INNODB;
CREATE TABLE t4(b1 INT, b2 INT, INDEX (b1, b2),
CONSTRAINT A3
FOREIGN KEY (b1, b2) REFERENCES t3(b1, b2)
ON UPDATE NO ACTION ON DELETE SET NULL) ENGINE=INNODB;
CREATE TABLE t5(b1 INT, b2 INT, INDEX (b1, b2),
CONSTRAINT A4
FOREIGN KEY (b1, b2) REFERENCES t4(b1, b2)
ON UPDATE RESTRICT ON DELETE CASCADE) ENGINE=INNODB;
select a.CONSTRAINT_SCHEMA, b.TABLE_NAME, CONSTRAINT_TYPE,
b.CONSTRAINT_NAME, UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME,
MATCH_OPTION, UPDATE_RULE, DELETE_RULE
from information_schema.TABLE_CONSTRAINTS a,
information_schema.REFERENTIAL_CONSTRAINTS b
where a.CONSTRAINT_SCHEMA = 'test' and a.CONSTRAINT_SCHEMA = b.CONSTRAINT_SCHEMA and
a.CONSTRAINT_NAME = b.CONSTRAINT_NAME;
CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_TYPE CONSTRAINT_NAME UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE
test t2 FOREIGN KEY A1 test t1 NONE CASCADE NO ACTION
test t3 FOREIGN KEY A2 test t2 NONE SET NULL RESTRICT
test t4 FOREIGN KEY A3 test t3 NONE NO ACTION SET NULL
test t5 FOREIGN KEY A4 test t4 NONE RESTRICT CASCADE
drop tables t5, t4, t3, t2, t1;

View File

@@ -0,0 +1,2 @@
running_as_root
NO

View File

@@ -278,3 +278,45 @@ field('str1', null, 'STR1') as c05,
c01 c02 c03 c04 c05 c08 c09
str str 0 1 2 1 1
set names latin1;
create table bug19145a (e enum('a','b','c') default 'b' , s set('x', 'y', 'z') default 'y' ) engine=MyISAM;
create table bug19145b (e enum('a','b','c') default null, s set('x', 'y', 'z') default null) engine=MyISAM;
create table bug19145c (e enum('a','b','c') not null default 'b' , s set('x', 'y', 'z') not null default 'y' ) engine=MyISAM;
create table bug19145setnotnulldefaultnull (e enum('a','b','c') default null, s set('x', 'y', 'z') not null default null) engine=MyISAM;
ERROR 42000: Invalid default value for 's'
create table bug19145enumnotnulldefaultnull (e enum('a','b','c') not null default null, s set('x', 'y', 'z') default null) engine=MyISAM;
ERROR 42000: Invalid default value for 'e'
alter table bug19145a alter column e set default null;
alter table bug19145a alter column s set default null;
alter table bug19145a add column (i int);
alter table bug19145b alter column e set default null;
alter table bug19145b alter column s set default null;
alter table bug19145b add column (i int);
alter table bug19145c alter column e set default null;
ERROR 42000: Invalid default value for 'e'
alter table bug19145c alter column s set default null;
ERROR 42000: Invalid default value for 's'
alter table bug19145c add column (i int);
show create table bug19145a;
Table Create Table
bug19145a CREATE TABLE `bug19145a` (
`e` enum('a','b','c') DEFAULT NULL,
`s` set('x','y','z') DEFAULT NULL,
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table bug19145b;
Table Create Table
bug19145b CREATE TABLE `bug19145b` (
`e` enum('a','b','c') DEFAULT NULL,
`s` set('x','y','z') DEFAULT NULL,
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table bug19145c;
Table Create Table
bug19145c CREATE TABLE `bug19145c` (
`e` enum('a','b','c') NOT NULL DEFAULT 'b',
`s` set('x','y','z') NOT NULL DEFAULT 'y',
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table bug19145a;
drop table bug19145b;
drop table bug19145c;

View File

@@ -38,7 +38,6 @@ f1
5
delete from t1;
ERROR 42000: DELETE command denied to user 'ssl_user4'@'localhost' for table 't1'
delete from mysql.user where user='ssl_user%';
delete from mysql.db where user='ssl_user%';
flush privileges;
drop user ssl_user1@localhost, ssl_user2@localhost,
ssl_user3@localhost, ssl_user4@localhost;
drop table t1;

View File

@@ -1056,3 +1056,104 @@ a b
1 9
3 7
drop table t1;
create table t1 (a int);
create table t2 like t1;
create table t3 like t2;
prepare stmt from "repair table t1";
execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
prepare stmt from "optimize table t1";
execute stmt;
Table Op Msg_type Msg_text
test.t1 optimize status OK
execute stmt;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
prepare stmt from "analyze table t1";
execute stmt;
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
execute stmt;
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
prepare stmt from "repair table t1, t2, t3";
execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t2 repair status OK
test.t3 repair status OK
execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t2 repair status OK
test.t3 repair status OK
prepare stmt from "optimize table t1, t2, t3";
execute stmt;
Table Op Msg_type Msg_text
test.t1 optimize status OK
test.t2 optimize status OK
test.t3 optimize status OK
execute stmt;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
test.t2 optimize status Table is already up to date
test.t3 optimize status Table is already up to date
prepare stmt from "analyze table t1, t2, t3";
execute stmt;
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
test.t2 analyze status Table is already up to date
test.t3 analyze status Table is already up to date
execute stmt;
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
test.t2 analyze status Table is already up to date
test.t3 analyze status Table is already up to date
prepare stmt from "repair table t1, t4, t3";
execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t4 repair error Table 'test.t4' doesn't exist
test.t3 repair status OK
Warnings:
Error 1146 Table 'test.t4' doesn't exist
execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t4 repair error Table 'test.t4' doesn't exist
test.t3 repair status OK
Warnings:
Error 1146 Table 'test.t4' doesn't exist
prepare stmt from "optimize table t1, t3, t4";
execute stmt;
Table Op Msg_type Msg_text
test.t1 optimize status OK
test.t3 optimize status OK
test.t4 optimize error Table 'test.t4' doesn't exist
Warnings:
Error 1146 Table 'test.t4' doesn't exist
execute stmt;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
test.t3 optimize status Table is already up to date
test.t4 optimize error Table 'test.t4' doesn't exist
Warnings:
Error 1146 Table 'test.t4' doesn't exist
prepare stmt from "analyze table t4, t1";
execute stmt;
Table Op Msg_type Msg_text
test.t4 analyze error Table 'test.t4' doesn't exist
test.t1 analyze status Table is already up to date
Warnings:
Error 1146 Table 'test.t4' doesn't exist
execute stmt;
Table Op Msg_type Msg_text
test.t4 analyze error Table 'test.t4' doesn't exist
test.t1 analyze status Table is already up to date
Warnings:
Error 1146 Table 'test.t4' doesn't exist
deallocate prepare stmt;

View File

@@ -116,3 +116,17 @@ execute st_1676 using @arg0, @arg1, @arg2;
cola colb cold
aaaa yyyy R
drop table t1, t2;
create table t1 (a int primary key);
insert into t1 values (1);
explain select * from t1 where 3 in (select (1+1) union select 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
select * from t1 where 3 in (select (1+1) union select 1);
a
prepare st_18492 from 'select * from t1 where 3 in (select (1+1) union select 1)';
execute st_18492;
a
drop table t1;

View File

@@ -410,13 +410,10 @@ ERROR HY000: This command is not supported in the prepared statement protocol ye
prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
execute stmt1 ;
prepare stmt1 from ' optimize table t1 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' analyze table t1 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' checksum table t1 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' repair table t1 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' handler t1 open ';

View File

@@ -24,6 +24,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
stop slave;
change master to master_user='root',master_password='', master_ssl=0;
start slave;
drop user replssl@localhost;
drop table t1;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master

View File

@@ -286,12 +286,12 @@ id stmt_text status
1 select 1 supported
2 flush tables not supported
3 handler t1 open as ha not supported
4 analyze table t1 not supported
4 analyze table t1 supported
5 check table t1 not supported
6 checksum table t1 not supported
7 check table t1 not supported
8 optimize table t1 not supported
9 repair table t1 not supported
8 optimize table t1 supported
9 repair table t1 supported
10 describe extended select * from t1 supported
11 help help not supported
12 show databases supported

View File

@@ -322,6 +322,7 @@ Warnings:
Warning 1541 The syntax 'SHOW INNODB STATUS' is deprecated and will be removed in MySQL 5.2. Please use 'SHOW ENGINE INNODB STATUS' instead.
GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost;
DROP DATABASE db_bug7787;
drop user user_bug7787@localhost;
use test;
---> connection: root

View File

@@ -204,3 +204,4 @@ drop procedure bug10100pv|
drop procedure bug10100pd|
drop procedure bug10100pc|
drop view v1|
drop table t3|

View File

@@ -744,7 +744,7 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
Warnings:
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `Not_used` having (<cache>(`test`.`t2`.`id`) = <null_helper>(1)) union select 1 AS `Not_used` having (<cache>(`test`.`t2`.`id`) = <null_helper>(3))))
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `1` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 AS `3` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
id
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);

View File

@@ -1,4 +1,5 @@
drop table if exists t1, t2;
drop function if exists f1;
create table t1 (ts timestamp);
set time_zone='+00:00';
select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
@@ -268,3 +269,17 @@ select * from t1;
convert_tz(NULL, NULL, NULL)
NULL
drop table t1;
create table t1 (ldt datetime, udt datetime);
create function f1(i datetime) returns datetime
return convert_tz(i, 'UTC', 'Europe/Moscow');
create trigger t1_bi before insert on t1 for each row
set new.udt:= convert_tz(new.ldt, 'Europe/Moscow', 'UTC');
insert into t1 (ldt) values ('2006-04-19 16:30:00');
select * from t1;
ldt udt
2006-04-19 16:30:00 2006-04-19 12:30:00
select ldt, f1(udt) as ldt2 from t1;
ldt ldt2
2006-04-19 16:30:00 2006-04-19 16:30:00
drop table t1;
drop function f1;

View File

@@ -949,7 +949,7 @@ insert into t1 values
create function f2() returns int return (select max(b) from t2);
insert into t2 select a, f2() from t1;
load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
drop tables t1, t2;
drop table t1, t2;
drop function f1;
drop function f2;
create table t1(i int not null, j int not null, n numeric(15,2), primary key(i,j));

View File

@@ -1,15 +1,15 @@
drop table if exists t1;
CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
CREATE FUNCTION myfunc_double RETURNS REAL SONAME 'udf_example.so';
CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME 'udf_example.so';
CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
ERROR HY000: Can't find symbol 'myfunc_nonexist' in library
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME 'udf_example.so';
CREATE FUNCTION sequence RETURNS INTEGER SONAME "udf_example.so";
CREATE FUNCTION lookup RETURNS STRING SONAME 'udf_example.so';
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
CREATE FUNCTION sequence RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
CREATE FUNCTION lookup RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
CREATE FUNCTION reverse_lookup
RETURNS STRING SONAME 'udf_example.so';
RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
CREATE AGGREGATE FUNCTION avgcost
RETURNS REAL SONAME 'udf_example.so';
RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
select myfunc_double();
ERROR HY000: myfunc_double must have at least one argument
select myfunc_double(1);

View File

@@ -215,9 +215,6 @@ select @@version;
select @@global.version;
@@global.version
#
select @@session.VERSION;
@@session.VERSION
#
set @first_var= NULL;
create table t1 select @first_var;
show create table t1;

View File

@@ -275,7 +275,7 @@ ERROR HY000: Variable 'autocommit' is a SESSION variable and can't be used with
select @@global.timestamp;
ERROR HY000: Variable 'timestamp' is a SESSION variable
set @@version='';
ERROR HY000: Unknown system variable 'version'
ERROR HY000: Variable 'version' is a read only variable
set @@concurrent_insert=1;
ERROR HY000: Variable 'concurrent_insert' is a GLOBAL variable and should be set with SET GLOBAL
set @@global.sql_auto_is_null=1;
@@ -384,6 +384,7 @@ select @@sql_max_join_size,@@max_join_size;
set sql_quote_show_create=1;
set sql_safe_updates=1;
set sql_select_limit=1;
set sql_select_limit=default;
set sql_warnings=1;
set global table_open_cache=100;
set storage_engine=myisam;
@@ -584,3 +585,31 @@ set @@global.character_set_filesystem=default;
select @@global.character_set_filesystem;
@@global.character_set_filesystem
binary
set @old_sql_big_selects = @@sql_big_selects;
set @@sql_big_selects = 1;
show variables like 'sql_big_selects';
Variable_name Value
sql_big_selects ON
set @@sql_big_selects = @old_sql_big_selects;
set @@sql_notes = 0, @@sql_warnings = 0;
show variables like 'sql_notes';
Variable_name Value
sql_notes OFF
show variables like 'sql_warnings';
Variable_name Value
sql_warnings OFF
set @@sql_notes = 1, @@sql_warnings = 1;
show variables like 'sql_notes';
Variable_name Value
sql_notes ON
show variables like 'sql_warnings';
Variable_name Value
sql_warnings ON
select @@system_time_zone;
@@system_time_zone
#
select @@version, @@version_comment, @@version_compile_machine,
@@version_compile_os;
@@version @@version_comment @@version_compile_machine @@version_compile_os
# # # #
End of 5.0 tests

View File

@@ -665,3 +665,12 @@ CALL p2();
EXTRACTVALUE(p,'/Ñ/r')
A
DROP PROCEDURE p2;
select extractValue('<ns:element xmlns:ns="myns"/>','count(ns:element)');
extractValue('<ns:element xmlns:ns="myns"/>','count(ns:element)')
1
select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element');
extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element')
a
select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element/@xmlns:ns');
extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element/@xmlns:ns')
myns

View File

@@ -47,7 +47,7 @@ select cast('1a' as signed);
select cast('' as signed);
#
# Character set convertion
# Character set conversion
#
set names binary;
select cast(_latin1'test' as char character set latin2);

View File

@@ -28,3 +28,5 @@ select * from t1 ignore index (primary) where tt like 'AA%';
select * from t1 where tt like '%AA%';
# End of 4.1 tests
drop table t1;

View File

@@ -15,6 +15,7 @@ events : BUG#17619 2006-02-21 andrey Race conditions
events_scheduling : BUG#19170 2006-04-26 andrey Test case of 19170 fails on some platforms. Has to be checked.
ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
ndb_binlog_discover : BUG#19395 2006-04-28 tomas/knielsen mysqld does not always detect cluster shutdown
#ndb_cache2 : BUG#18597 2006-03-28 brian simultaneous drop table and ndb statistics update triggers node failure
#ndb_cache_multi2 : BUG#18597 2006-04-10 kent simultaneous drop table and ndb statistics update triggers node failure
partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table
@@ -32,7 +33,6 @@ rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly
rpl_row_func003 : BUG#19074 2006-13-04 andrei test failed
rpl_row_inexist_tbl : BUG#18948 2006-03-09 mats Disabled since patch makes this test wait forever
rpl_sp : BUG#16456 2006-02-16 jmiller
mysqldump : BUG#18078 2006-03-10 lars
udf : BUG#18564 2006-03-27 ian (Permission by Brian)
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open

View File

@@ -320,9 +320,9 @@ drop event one_event;
create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
drop event e_26;
--error 1504
--error ER_WRONG_VALUE
create event e_26 on schedule at NULL disabled do set @a = 5;
--error 1504
--error ER_WRONG_VALUE
create event e_26 on schedule at 'definitely not a datetime' disabled do set @a = 5;
set names utf8;

View File

@@ -462,3 +462,29 @@ drop table t1, t2;
drop database TESTDB;
flush privileges;
#
# BUG#13310 incorrect user parsing by SP
#
grant all privileges on test.* to `a@`@localhost;
grant execute on * to `a@`@localhost;
connect (bug13310,localhost,'a@',,test);
connection bug13310;
create table t2 (s1 int);
insert into t2 values (1);
--disable_warnings
drop function if exists f2;
--enable_warnings
delimiter //;
create function f2 () returns int begin declare v int; select s1 from t2
into v; return v; end//
delimiter ;//
select f2();
drop function f2;
drop table t2;
disconnect bug13310;
connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
drop user `a@`@localhost;

View File

@@ -393,3 +393,16 @@ SELECT EMPNUM, GRADE*1000
HAVING HU.PROJ.CITY = HU.STAFF.CITY);
DROP SCHEMA HU;
USE test;
#
# Bug#18739: non-standard HAVING extension was allowed in strict ANSI sql mode.
#
create table t1(f1 int);
select f1 from t1 having max(f1)=f1;
select f1 from t1 group by f1 having max(f1)=f1;
set session sql_mode='ONLY_FULL_GROUP_BY';
--error ER_NON_GROUPING_FIELD_USED
select f1 from t1 having max(f1)=f1;
select f1 from t1 group by f1 having max(f1)=f1;
set session sql_mode='';
drop table t1;

View File

@@ -1,10 +1,13 @@
# This test uses grants, which can't get tested for embedded server
-- source include/not_embedded.inc
# check that CSV engine was compiled in, as the result of the test
# depends on the presence of the log tables (which are CSV-based).
# check that CSV engine was compiled in, as the result of the test depends
# on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc
# This test uses chmod, can't be run with root permissions
-- source include/not_as_root.inc
# Test for information_schema.schemata &
# show databases

View File

@@ -21,3 +21,35 @@ select * from information_schema.KEY_COLUMN_USAGE where
TABLE_SCHEMA= "test";
drop table t3, t2, t1;
#
# Test for REFERENTIAL_CONSTRAINTS table
#
CREATE TABLE t1(a1 INT NOT NULL, a2 INT NOT NULL,
PRIMARY KEY(a1, a2)) ENGINE=INNODB;
CREATE TABLE t2(b1 INT, b2 INT, INDEX (b1, b2),
CONSTRAINT A1
FOREIGN KEY (b1, b2) REFERENCES t1(a1, a2)
ON UPDATE CASCADE ON DELETE NO ACTION) ENGINE=INNODB;
CREATE TABLE t3(b1 INT, b2 INT, INDEX (b1, b2),
CONSTRAINT A2
FOREIGN KEY (b1, b2) REFERENCES t2(b1, b2)
ON UPDATE SET NULL ON DELETE RESTRICT) ENGINE=INNODB;
CREATE TABLE t4(b1 INT, b2 INT, INDEX (b1, b2),
CONSTRAINT A3
FOREIGN KEY (b1, b2) REFERENCES t3(b1, b2)
ON UPDATE NO ACTION ON DELETE SET NULL) ENGINE=INNODB;
CREATE TABLE t5(b1 INT, b2 INT, INDEX (b1, b2),
CONSTRAINT A4
FOREIGN KEY (b1, b2) REFERENCES t4(b1, b2)
ON UPDATE RESTRICT ON DELETE CASCADE) ENGINE=INNODB;
select a.CONSTRAINT_SCHEMA, b.TABLE_NAME, CONSTRAINT_TYPE,
b.CONSTRAINT_NAME, UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME,
MATCH_OPTION, UPDATE_RULE, DELETE_RULE
from information_schema.TABLE_CONSTRAINTS a,
information_schema.REFERENTIAL_CONSTRAINTS b
where a.CONSTRAINT_SCHEMA = 'test' and a.CONSTRAINT_SCHEMA = b.CONSTRAINT_SCHEMA and
a.CONSTRAINT_NAME = b.CONSTRAINT_NAME;
drop tables t5, t4, t3, t2, t1;

View File

@@ -0,0 +1 @@
--log --log-output=FILE

View File

@@ -1174,8 +1174,8 @@ create database first;
use first;
set time_zone = 'UTC';
## prove one works
create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5;
## prove one works (with spaces and tabs on the end)
create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5;
show events;
show create event ee1;
--exec $MYSQL_DUMP --events first > $MYSQLTEST_VARDIR/tmp/bug16853-1.sql
@@ -1187,10 +1187,10 @@ use second;
show events;
show create event ee1;
## prove three works
## prove three works (with spaces and tabs on the end)
# start with one from the previous restore
create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5;
create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;
create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5;
create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;
show events;
--exec $MYSQL_DUMP --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql
drop database second;

View File

@@ -190,4 +190,45 @@ select
# Restore charset to the default value.
set names latin1;
#
# Bug#19145: mysqld crashes if you set the default value of an enum field to NULL
#
create table bug19145a (e enum('a','b','c') default 'b' , s set('x', 'y', 'z') default 'y' ) engine=MyISAM;
create table bug19145b (e enum('a','b','c') default null, s set('x', 'y', 'z') default null) engine=MyISAM;
create table bug19145c (e enum('a','b','c') not null default 'b' , s set('x', 'y', 'z') not null default 'y' ) engine=MyISAM;
# Invalid default value for 's'
--error 1067
create table bug19145setnotnulldefaultnull (e enum('a','b','c') default null, s set('x', 'y', 'z') not null default null) engine=MyISAM;
# Invalid default value for 'e'
--error 1067
create table bug19145enumnotnulldefaultnull (e enum('a','b','c') not null default null, s set('x', 'y', 'z') default null) engine=MyISAM;
alter table bug19145a alter column e set default null;
alter table bug19145a alter column s set default null;
alter table bug19145a add column (i int);
alter table bug19145b alter column e set default null;
alter table bug19145b alter column s set default null;
alter table bug19145b add column (i int);
# Invalid default value for 'e'
--error 1067
alter table bug19145c alter column e set default null;
# Invalid default value for 's'
--error 1067
alter table bug19145c alter column s set default null;
alter table bug19145c add column (i int);
show create table bug19145a;
show create table bug19145b;
show create table bug19145c;
drop table bug19145a;
drop table bug19145b;
drop table bug19145c;
# End of 4.1 tests

View File

@@ -48,9 +48,9 @@ select * from t1;
delete from t1;
connection default;
delete from mysql.user where user='ssl_user%';
delete from mysql.db where user='ssl_user%';
flush privileges;
drop user ssl_user1@localhost, ssl_user2@localhost,
ssl_user3@localhost, ssl_user4@localhost;
drop table t1;
# End of 4.1 tests

View File

@@ -1110,4 +1110,40 @@ select * from t1 order by 1+1;
drop table t1;
#
# Bug#19308 "REPAIR/OPTIMIZE/ANALYZE supported in SP but not in PS".
# Add test coverage for the added commands.
#
create table t1 (a int);
create table t2 like t1;
create table t3 like t2;
prepare stmt from "repair table t1";
execute stmt;
execute stmt;
prepare stmt from "optimize table t1";
execute stmt;
execute stmt;
prepare stmt from "analyze table t1";
execute stmt;
execute stmt;
prepare stmt from "repair table t1, t2, t3";
execute stmt;
execute stmt;
prepare stmt from "optimize table t1, t2, t3";
execute stmt;
execute stmt;
prepare stmt from "analyze table t1, t2, t3";
execute stmt;
execute stmt;
prepare stmt from "repair table t1, t4, t3";
execute stmt;
execute stmt;
prepare stmt from "optimize table t1, t3, t4";
execute stmt;
execute stmt;
prepare stmt from "analyze table t4, t1";
execute stmt;
execute stmt;
deallocate prepare stmt;
# End of 5.0 tests

View File

@@ -130,3 +130,17 @@ drop table t1, t2;
# end of bug#1676
# End of 4.1 tests
# bug#18492: mysqld reports ER_ILLEGAL_REFERENCE in --ps-protocol
create table t1 (a int primary key);
insert into t1 values (1);
explain select * from t1 where 3 in (select (1+1) union select 1);
select * from t1 where 3 in (select (1+1) union select 1);
prepare st_18492 from 'select * from t1 where 3 in (select (1+1) union select 1)';
execute st_18492;
drop table t1;

View File

@@ -456,13 +456,10 @@ into table t1 fields terminated by ''\t'' ';
prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
execute stmt1 ;
##
--error 1295
prepare stmt1 from ' optimize table t1 ' ;
--error 1295
prepare stmt1 from ' analyze table t1 ' ;
--error 1295
prepare stmt1 from ' checksum table t1 ' ;
--error 1295
prepare stmt1 from ' repair table t1 ' ;
--error 1295
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;

View File

@@ -207,7 +207,7 @@ show status like "Qcache_queries_in_cache";
drop table t1;
#
# Charset convertion (cp1251_koi8 always present)
# Charset conversion (cp1251_koi8 always present)
#
create table t1 (a char(1) not null collate koi8r_general_ci);
insert into t1 values(_koi8r"<22>");

View File

@@ -53,6 +53,7 @@ stop slave;
change master to master_user='root',master_password='', master_ssl=0;
start slave;
connection master;
drop user replssl@localhost;
drop table t1;
save_master_pos;
connection slave;

View File

@@ -1,3 +1,6 @@
# This test uses chmod, can't be run with root permissions
-- source include/not_as_root.inc
#
# Test is run with max_binlog_size=2048 to force automatic rotation of the
# binary log

View File

@@ -545,6 +545,7 @@ GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost;
# Cleanup.
DROP DATABASE db_bug7787;
drop user user_bug7787@localhost;
use test;

View File

@@ -258,5 +258,6 @@ drop procedure bug10100pv|
drop procedure bug10100pd|
drop procedure bug10100pc|
drop view v1|
drop table t3|
delimiter ;|

View File

@@ -3,6 +3,7 @@
# Preparing playground
--disable_warnings
drop table if exists t1, t2;
drop function if exists f1;
--enable_warnings
@@ -222,3 +223,22 @@ select * from t1;
drop table t1;
# End of 4.1 tests
#
# Test for bug #11081 "Using a CONVERT_TZ function in a stored function
# or trigger fails".
#
create table t1 (ldt datetime, udt datetime);
create function f1(i datetime) returns datetime
return convert_tz(i, 'UTC', 'Europe/Moscow');
create trigger t1_bi before insert on t1 for each row
set new.udt:= convert_tz(new.ldt, 'Europe/Moscow', 'UTC');
# This should work without errors
insert into t1 (ldt) values ('2006-04-19 16:30:00');
select * from t1;
# This should work without errors as well
select ldt, f1(udt) as ldt2 from t1;
drop table t1;
drop function f1;
# End of 5.0 tests

View File

@@ -1111,7 +1111,7 @@ insert into t1 values
create function f2() returns int return (select max(b) from t2);
insert into t2 select a, f2() from t1;
load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
drop tables t1, t2;
drop table t1, t2;
drop function f1;
drop function f2;

View File

@@ -14,18 +14,26 @@ drop table if exists t1;
# Create the example functions from udf_example
#
CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
CREATE FUNCTION myfunc_double RETURNS REAL SONAME 'udf_example.so';
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_LIB";
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
--error ER_CANT_FIND_DL_ENTRY
CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME 'udf_example.so';
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME 'udf_example.so';
CREATE FUNCTION sequence RETURNS INTEGER SONAME "udf_example.so";
CREATE FUNCTION lookup RETURNS STRING SONAME 'udf_example.so';
CREATE FUNCTION reverse_lookup
RETURNS STRING SONAME 'udf_example.so';
CREATE AGGREGATE FUNCTION avgcost
RETURNS REAL SONAME 'udf_example.so';
eval CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB";
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB";
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
eval CREATE FUNCTION sequence RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB";
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
eval CREATE FUNCTION lookup RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
eval CREATE FUNCTION reverse_lookup
RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
eval CREATE AGGREGATE FUNCTION avgcost
RETURNS REAL SONAME "$UDF_EXAMPLE_LIB";
--error 0
select myfunc_double();

View File

@@ -143,8 +143,6 @@ select @@Max_Allowed_Packet;
select @@version;
--replace_column 1 #
select @@global.version;
--replace_column 1 #
select @@session.VERSION;
# End of 4.1 tests

View File

@@ -169,7 +169,7 @@ set collation_connection=NULL;
set global autocommit=1;
--error 1238
select @@global.timestamp;
--error 1193
--error 1238
set @@version='';
--error 1229
set @@concurrent_insert=1;
@@ -258,6 +258,8 @@ select @@sql_max_join_size,@@max_join_size;
set sql_quote_show_create=1;
set sql_safe_updates=1;
set sql_select_limit=1;
# reset it, so later tests don't get confused
set sql_select_limit=default;
set sql_warnings=1;
set global table_open_cache=100;
set storage_engine=myisam;
@@ -472,4 +474,38 @@ select @@character_set_filesystem;
set @@global.character_set_filesystem=default;
select @@global.character_set_filesystem;
# End of 5.0 tests
#
# Bug #17849: Show sql_big_selects in SHOW VARIABLES
#
set @old_sql_big_selects = @@sql_big_selects;
set @@sql_big_selects = 1;
show variables like 'sql_big_selects';
set @@sql_big_selects = @old_sql_big_selects;
#
# Bug #16195: SHOW VARIABLES doesn't report correctly sql_warnings and
# sql_notes values
#
set @@sql_notes = 0, @@sql_warnings = 0;
show variables like 'sql_notes';
show variables like 'sql_warnings';
set @@sql_notes = 1, @@sql_warnings = 1;
show variables like 'sql_notes';
show variables like 'sql_warnings';
#
# Bug #12792: @@system_time_zone is not SELECTable.
#
# Don't actually output, since it depends on the system
--replace_column 1 #
select @@system_time_zone;
#
# Bug #15684: system variables cannot be SELECTed (e.g. @@version_comment)
#
# Don't actually output, since it depends on the system
--replace_column 1 # 2 # 3 # 4 #
select @@version, @@version_comment, @@version_compile_machine,
@@version_compile_os;
--echo End of 5.0 tests

View File

@@ -32,7 +32,7 @@ grant create view,select on test.* to mysqltest_1@localhost;
connect (user1,localhost,mysqltest_1,,test);
connection user1;
-- error ER_SPECIFIC_ACCESS_DENIED
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
create definer=root@localhost view v1 as select * from mysqltest.t1;
create view v1 as select * from mysqltest.t1;
# try to modify view without DROP privilege on it

View File

@@ -335,3 +335,11 @@ END//
DELIMITER ;//
CALL p2();
DROP PROCEDURE p2;
#
# Bug#18170: XML: ExtractValue():
# XPath expression can't use QNames (colon in names)
#
select extractValue('<ns:element xmlns:ns="myns"/>','count(ns:element)');
select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element');
select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element/@xmlns:ns');