mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge bk-internal:/home/bk/mysql-5.1
into neptunus.(none):/home/msvensson/mysql/mysql-5.1-new-maint BUILD/compile-dist: Auto merged client/mysqltest.c: Auto merged config/ac-macros/ssl.m4: Auto merged include/config-win.h: Auto merged include/my_base.h: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/func_group.result: Auto merged mysql-test/r/group_min_max.result: Auto merged mysql-test/r/partition.result: Auto merged mysql-test/r/ps.result: Auto merged mysql-test/r/rpl_insert_id_pk.result: Auto merged mysql-test/r/rpl_ndb_multi_update3.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/join_outer.test: Auto merged mysql-test/t/partition.test: Auto merged mysql-test/t/ps.test: Auto merged mysql-test/r/rpl_ndb_sp006.result: Auto merged mysql-test/t/sp.test: Auto merged mysys/my_clock.c: Auto merged mysys/my_copy.c: Auto merged mysys/my_create.c: Auto merged mysys/my_dup.c: Auto merged mysys/my_lib.c: Auto merged mysys/my_open.c: Auto merged mysys/my_redel.c: Auto merged mysql-test/r/create.result: Manual merge mysql-test/r/innodb_mysql.result: Manual merge mysql-test/r/join_outer.result: Manual merge mysql-test/t/func_group.test: Manual merge mysql-test/t/group_min_max.test: Manual merge mysql-test/t/innodb_mysql.test: Manual merge
This commit is contained in:
@ -2518,7 +2518,7 @@ int safe_connect(MYSQL* mysql, const char *host, const char *user,
|
||||
{
|
||||
int con_error= 1;
|
||||
my_bool reconnect= 1;
|
||||
static int connection_retry_sleep= 2; /* Seconds */
|
||||
static ulong connection_retry_sleep= 100000; /* Microseconds */
|
||||
int i;
|
||||
for (i= 0; i < opt_max_connect_retries; i++)
|
||||
{
|
||||
@ -2528,7 +2528,7 @@ int safe_connect(MYSQL* mysql, const char *host, const char *user,
|
||||
con_error= 0;
|
||||
break;
|
||||
}
|
||||
sleep(connection_retry_sleep);
|
||||
my_sleep(connection_retry_sleep);
|
||||
}
|
||||
/*
|
||||
TODO: change this to 0 in future versions, but the 'kill' test relies on
|
||||
@ -3301,7 +3301,7 @@ static struct my_option my_long_options[] =
|
||||
{"max-connect-retries", OPT_MAX_CONNECT_RETRIES,
|
||||
"Max number of connection attempts when connecting to server",
|
||||
(gptr*) &opt_max_connect_retries, (gptr*) &opt_max_connect_retries, 0,
|
||||
GET_INT, REQUIRED_ARG, 5, 1, 10, 0, 0, 0},
|
||||
GET_INT, REQUIRED_ARG, 500, 1, 10000, 0, 0, 0},
|
||||
{"password", 'p', "Password to use when connecting to server.",
|
||||
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"port", 'P', "Port number to use for connection.", (gptr*) &port,
|
||||
|
@ -30,7 +30,6 @@ functions */
|
||||
|
||||
#include <sys/locking.h>
|
||||
#include <windows.h>
|
||||
#include <math.h> /* Because of rint() */
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <malloc.h>
|
||||
@ -223,17 +222,9 @@ typedef uint rf_SetTimer;
|
||||
#define inline __inline
|
||||
#endif /* __cplusplus */
|
||||
|
||||
inline double rint(double nr)
|
||||
{
|
||||
double f = floor(nr);
|
||||
double c = ceil(nr);
|
||||
return (((c-nr) >= (nr-f)) ? f :c);
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
#define ulonglong2double(A) ((double) (ulonglong) (A))
|
||||
#define my_off_t2double(A) ((double) (my_off_t) (A))
|
||||
|
||||
#else
|
||||
inline double ulonglong2double(ulonglong value)
|
||||
{
|
||||
@ -339,7 +330,6 @@ inline double ulonglong2double(ulonglong value)
|
||||
#define HAVE_FLOAT_H
|
||||
#define HAVE_LIMITS_H
|
||||
#define HAVE_STDDEF_H
|
||||
#define HAVE_RINT /* defined in this file */
|
||||
#define NO_FCNTL_NONBLOCK /* No FCNTL */
|
||||
#define HAVE_ALLOCA
|
||||
#define HAVE_STRPBRK
|
||||
|
@ -21,7 +21,6 @@
|
||||
#define _my_base_h
|
||||
|
||||
#ifndef stdin /* Included first in handler */
|
||||
#define USES_TYPES /* my_dir with sys/types is included */
|
||||
#define CHSIZE_USED
|
||||
#include <my_global.h>
|
||||
#include <my_dir.h> /* This includes types */
|
||||
|
@ -83,5 +83,6 @@ SET FOREIGN_KEY_CHECKS=0;
|
||||
--error 1022, 1062
|
||||
INSERT INTO t1 VALUES (1),(1);
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
# End of 4.1 tests
|
||||
|
@ -152,5 +152,5 @@ wait_for_slave_to_stop;
|
||||
drop table t2;
|
||||
connection master;
|
||||
drop table t2;
|
||||
|
||||
drop table t1;
|
||||
# End of 4.1 tests
|
||||
|
@ -126,7 +126,7 @@ show slave status;
|
||||
show binlog events in 'slave-bin.000005' from 4;
|
||||
|
||||
# The table drops caused Cluster Replication wrapper to fail as event ID would never be the same.# Moving drops here.
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
|
@ -217,4 +217,6 @@ select "-- SLAVE AFTER JOIN --" as "";
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2;
|
||||
# End of 4.1 tests
|
||||
|
@ -76,6 +76,7 @@ DROP PROCEDURE IF EXISTS mysqltest1.p1;
|
||||
DROP PROCEDURE IF EXISTS mysqltest1.p2;
|
||||
DROP TABLE IF EXISTS mysqltest1.t1;
|
||||
DROP TABLE IF EXISTS mysqltest1.t2;
|
||||
DROP DATABASE mysqltest1;
|
||||
|
||||
# Lets compare. Note: If they match test will pass, if they do not match
|
||||
# the test will show that the diff statement failed and not reject file
|
||||
|
@ -21,13 +21,13 @@ show databases;
|
||||
#
|
||||
# Dump the "test" database, all it's tables and their data
|
||||
#
|
||||
--exec $MYSQL_DUMP --skip-comments test
|
||||
--exec $MYSQL_DUMP --skip-comments --skip-lock-tables test
|
||||
|
||||
#
|
||||
# Dump the "mysql" database and it's tables
|
||||
# Select data separately to add "order by"
|
||||
#
|
||||
--exec $MYSQL_DUMP --skip-comments --no-data mysql
|
||||
--exec $MYSQL_DUMP --skip-comments --skip-lock-tables --no-data mysql
|
||||
use mysql;
|
||||
select * from columns_priv;
|
||||
select * from db order by host, db, user;
|
||||
|
@ -455,6 +455,16 @@ sub collect_one_test_case($$$$$$$) {
|
||||
"Test case '$tname' is skipped.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_options_from_test_file($tinfo,"$testdir/${tname}.test");
|
||||
|
||||
if ( ! $tinfo->{'innodb_test'} )
|
||||
{
|
||||
# mtr_report("Adding '--skip-innodb' to $tinfo->{'name'}");
|
||||
push(@{$tinfo->{'master_opt'}}, "--skip-innodb");
|
||||
}
|
||||
}
|
||||
|
||||
# We can't restart a running server that may be in use
|
||||
|
||||
@ -463,7 +473,39 @@ sub collect_one_test_case($$$$$$$) {
|
||||
{
|
||||
$tinfo->{'skip'}= 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub mtr_options_from_test_file($$$) {
|
||||
my $tinfo= shift;
|
||||
my $file= shift;
|
||||
|
||||
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
|
||||
my @args;
|
||||
while ( <FILE> )
|
||||
{
|
||||
chomp;
|
||||
|
||||
# Check if test uses innodb
|
||||
if ( defined mtr_match_substring($_,"include/have_innodb.inc"))
|
||||
{
|
||||
$tinfo->{'innodb_test'} = 1;
|
||||
}
|
||||
|
||||
# If test sources another file, open it as well
|
||||
my $value= mtr_match_prefix($_, "--source");
|
||||
if ( defined $value)
|
||||
{
|
||||
$value=~ s/^\s+//; # Remove leading space
|
||||
$value=~ s/\s+$//; # Remove ending space
|
||||
|
||||
my $sourced_file= "$::glob_mysql_test_dir/$value";
|
||||
mtr_options_from_test_file($tinfo, $sourced_file);
|
||||
}
|
||||
|
||||
}
|
||||
close FILE;
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -14,12 +14,17 @@ use POSIX 'WNOHANG';
|
||||
|
||||
sub mtr_run ($$$$$$;$);
|
||||
sub mtr_spawn ($$$$$$;$);
|
||||
sub mtr_stop_mysqld_servers ($);
|
||||
sub mtr_check_stop_servers ($);
|
||||
sub mtr_kill_leftovers ();
|
||||
sub mtr_wait_blocking ($);
|
||||
sub mtr_record_dead_children ();
|
||||
sub mtr_ndbmgm_start($$);
|
||||
sub mtr_mysqladmin_start($$$);
|
||||
sub mtr_exit ($);
|
||||
sub sleep_until_file_created ($$$);
|
||||
sub mtr_kill_processes ($);
|
||||
sub mtr_ping_with_timeout($);
|
||||
sub mtr_ping_port ($);
|
||||
sub mtr_kill_process ($$$$);
|
||||
|
||||
# static in C
|
||||
@ -32,7 +37,6 @@ sub spawn_impl ($$$$$$$$);
|
||||
##############################################################################
|
||||
|
||||
# This function try to mimic the C version used in "netware/mysql_test_run.c"
|
||||
# FIXME learn it to handle append mode as well, a "new" flag or a "append"
|
||||
|
||||
sub mtr_run ($$$$$$;$) {
|
||||
my $path= shift;
|
||||
@ -293,7 +297,7 @@ sub spawn_parent_impl {
|
||||
}
|
||||
}
|
||||
|
||||
mtr_debug("waitpid() catched exit of unknown child $ret_pid, " .
|
||||
mtr_debug("waitpid() caught exit of unknown child $ret_pid, " .
|
||||
"exit during mysqltest run");
|
||||
}
|
||||
|
||||
@ -347,49 +351,70 @@ sub mtr_process_exit_status {
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# We just "ping" on the ports, and if we can't do a socket connect
|
||||
# we assume the server is dead. So we don't *really* know a server
|
||||
# is dead, we just hope that it after letting the listen port go,
|
||||
# it is dead enough for us to start a new server.
|
||||
|
||||
# Kill all processes(mysqld, ndbd, ndb_mgmd and im) that would conflict with
|
||||
# this run
|
||||
# Make sure to remove the PID file, if any.
|
||||
# kill IM manager first, else it will restart the servers
|
||||
sub mtr_kill_leftovers () {
|
||||
|
||||
# First, kill all masters and slaves that would conflict with
|
||||
# this run. Make sure to remove the PID file, if any.
|
||||
# FIXME kill IM manager first, else it will restart the servers, how?!
|
||||
my @args;
|
||||
my @kill_pids;
|
||||
my %admin_pids;
|
||||
my $pid;
|
||||
|
||||
for ( my $idx; $idx < 2; $idx++ )
|
||||
#Start shutdown of instance_managers, masters and slaves
|
||||
foreach my $srv (@{$::instance_manager->{'instances'}},@{$::master},@{$::slave})
|
||||
{
|
||||
push(@args,{
|
||||
pid => 0, # We don't know the PID
|
||||
pidfile => $::instance_manager->{'instances'}->[$idx]->{'path_pid'},
|
||||
sockfile => $::instance_manager->{'instances'}->[$idx]->{'path_sock'},
|
||||
port => $::instance_manager->{'instances'}->[$idx]->{'port'},
|
||||
$pid= mtr_mysqladmin_start($srv, "shutdown", 70);
|
||||
|
||||
# Save the pid of the mysqladmin process
|
||||
$admin_pids{$pid}= 1;
|
||||
|
||||
push(@kill_pids,{
|
||||
pid => $srv->{'pid'},
|
||||
pidfile => $srv->{'path_pid'},
|
||||
sockfile => $srv->{'path_sock'},
|
||||
port => $srv->{'port'},
|
||||
});
|
||||
$srv->{'pid'}= 0; # Assume we are done with it
|
||||
}
|
||||
|
||||
for ( my $idx; $idx < 2; $idx++ )
|
||||
# Start shutdown of clusters
|
||||
foreach my $cluster (@{$::clusters})
|
||||
{
|
||||
push(@args,{
|
||||
pid => 0, # We don't know the PID
|
||||
pidfile => $::master->[$idx]->{'path_mypid'},
|
||||
sockfile => $::master->[$idx]->{'path_mysock'},
|
||||
port => $::master->[$idx]->{'path_myport'},
|
||||
$pid= mtr_ndbmgm_start($cluster, "shutdown");
|
||||
|
||||
# Save the pid of the ndb_mgm process
|
||||
$admin_pids{$pid}= 1;
|
||||
|
||||
push(@kill_pids,{
|
||||
pid => $cluster->{'pid'},
|
||||
pidfile => $cluster->{'path_pid'}
|
||||
});
|
||||
|
||||
$cluster->{'pid'}= 0; # Assume we are done with it
|
||||
|
||||
|
||||
foreach my $ndbd (@{$cluster->{'ndbds'}})
|
||||
{
|
||||
push(@kill_pids,{
|
||||
pid => $ndbd->{'pid'},
|
||||
pidfile => $ndbd->{'path_pid'},
|
||||
});
|
||||
$ndbd->{'pid'}= 0; # Assume we are done with it
|
||||
}
|
||||
|
||||
for ( my $idx; $idx < 3; $idx++ )
|
||||
{
|
||||
push(@args,{
|
||||
pid => 0, # We don't know the PID
|
||||
pidfile => $::slave->[$idx]->{'path_mypid'},
|
||||
sockfile => $::slave->[$idx]->{'path_mysock'},
|
||||
port => $::slave->[$idx]->{'path_myport'},
|
||||
});
|
||||
}
|
||||
|
||||
mtr_mysqladmin_shutdown(\@args, 20);
|
||||
# Wait for all the admin processes to complete
|
||||
mtr_wait_blocking(\%admin_pids);
|
||||
|
||||
# If we trusted "mysqladmin --shutdown_timeout= ..." we could just
|
||||
# terminate now, but we don't (FIXME should be debugged).
|
||||
# So we try again to ping and at least wait the same amount of time
|
||||
# mysqladmin would for all to die.
|
||||
|
||||
mtr_ping_with_timeout(\@kill_pids);
|
||||
|
||||
# We now have tried to terminate nice. We have waited for the listen
|
||||
# port to be free, but can't really tell if the mysqld process died
|
||||
@ -454,7 +479,7 @@ sub mtr_kill_leftovers () {
|
||||
do
|
||||
{
|
||||
kill(9, @pids);
|
||||
mtr_debug("Sleep 1 second waiting for processes to die");
|
||||
mtr_report("Sleep 1 second waiting for processes to die");
|
||||
sleep(1) # Wait one second
|
||||
} while ( $retries-- and kill(0, @pids) );
|
||||
|
||||
@ -466,54 +491,62 @@ sub mtr_kill_leftovers () {
|
||||
}
|
||||
}
|
||||
|
||||
# We may have failed everything, bug we now check again if we have
|
||||
# We may have failed everything, but we now check again if we have
|
||||
# the listen ports free to use, and if they are free, just go for it.
|
||||
|
||||
foreach my $srv ( @args )
|
||||
foreach my $srv ( @kill_pids )
|
||||
{
|
||||
if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) )
|
||||
if ( mtr_ping_port($srv->{'port'}) )
|
||||
{
|
||||
mtr_warning("can't kill old mysqld holding port $srv->{'port'}");
|
||||
mtr_warning("can't kill old process holding port $srv->{'port'}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Shut down mysqld servers we have started from this run of this script
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# To speed things we kill servers in parallel. The argument is a list
|
||||
# of 'ports', 'pids', 'pidfiles' and 'socketfiles'.
|
||||
|
||||
# Check that all processes in list are killed
|
||||
# The argument is a list of 'ports', 'pids', 'pidfiles' and 'socketfiles'
|
||||
# for which shutdown has been started. Make sure they all get killed
|
||||
# in one way or the other.
|
||||
#
|
||||
# FIXME On Cygwin, and maybe some other platforms, $srv->{'pid'} and
|
||||
# $srv->{'pidfile'} will not be the same PID. We need to try to kill
|
||||
# the pid in $srv->{'pidfile'} will not be the same PID. We need to try to kill
|
||||
# both I think.
|
||||
|
||||
sub mtr_stop_mysqld_servers ($) {
|
||||
sub mtr_check_stop_servers ($) {
|
||||
my $spec= shift;
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# First try nice normal shutdown using 'mysqladmin'
|
||||
# ----------------------------------------------------------------------
|
||||
# Return if no processes are defined
|
||||
return if ! @$spec;
|
||||
|
||||
# Shutdown time must be high as slave may be in reconnect
|
||||
mtr_mysqladmin_shutdown($spec, 70);
|
||||
#mtr_report("mtr_check_stop_servers");
|
||||
|
||||
mtr_ping_with_timeout(\@$spec);
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# We loop with waitpid() nonblocking to see how many of the ones we
|
||||
# are to kill, actually got killed by mtr_mysqladmin_shutdown().
|
||||
# Note that we don't rely on this, the mysqld server might have stop
|
||||
# are to kill, actually got killed by mysqladmin or ndb_mgm
|
||||
#
|
||||
# Note that we don't rely on this, the mysqld server might have stopped
|
||||
# listening to the port, but still be alive. But it is a start.
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
foreach my $srv ( @$spec )
|
||||
{
|
||||
if ( $srv->{'pid'} and (waitpid($srv->{'pid'},&WNOHANG) == $srv->{'pid'}) )
|
||||
my $ret_pid;
|
||||
if ( $srv->{'pid'} )
|
||||
{
|
||||
$ret_pid= waitpid($srv->{'pid'},&WNOHANG);
|
||||
if ($ret_pid == $srv->{'pid'})
|
||||
{
|
||||
mtr_verbose("Caught exit of process $ret_pid");
|
||||
$srv->{'pid'}= 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
# mtr_warning("caught exit of unknown child $ret_pid");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
@ -546,13 +579,12 @@ sub mtr_stop_mysqld_servers ($) {
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# If the processes where started from this script, and we had no PIDS
|
||||
# If all the processes in list already have been killed,
|
||||
# then we don't have to do anything.
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
if ( ! keys %mysqld_pids )
|
||||
{
|
||||
# cluck "This is how we got here!";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -622,86 +654,96 @@ sub mtr_stop_mysqld_servers ($) {
|
||||
|
||||
}
|
||||
|
||||
# Wait for all the process in the list to terminate
|
||||
sub mtr_wait_blocking($) {
|
||||
my $admin_pids= shift;
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Shut down mysqld servers using "mysqladmin ... shutdown".
|
||||
# To speed this up, we start them in parallel and use waitpid() to
|
||||
# catch their termination. Note that this doesn't say the servers
|
||||
# are terminated, just that 'mysqladmin' is terminated.
|
||||
#
|
||||
# Note that mysqladmin will ask the server about what PID file it uses,
|
||||
# and mysqladmin will wait for it to be removed before it terminates
|
||||
# (unless passes timeout).
|
||||
#
|
||||
# This function will take at most about 20 seconds, and we still are not
|
||||
# sure we killed them all. If none is responding to ping, we return 1,
|
||||
# else we return 0.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub mtr_mysqladmin_shutdown {
|
||||
my $spec= shift;
|
||||
# Return if no processes defined
|
||||
return if ! %$admin_pids;
|
||||
|
||||
mtr_verbose("mtr_wait_blocking");
|
||||
|
||||
# Wait for all the started processes to exit
|
||||
# As mysqladmin is such a simple program, we trust it to terminate itself.
|
||||
# I.e. we wait blocking, and wait for them all before we go on.
|
||||
foreach my $pid (keys %{$admin_pids})
|
||||
{
|
||||
my $ret_pid= waitpid($pid,0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
# Start "mysqladmin shutdown" for a specific mysqld
|
||||
sub mtr_mysqladmin_start($$$) {
|
||||
my $srv= shift;
|
||||
my $command= shift;
|
||||
my $adm_shutdown_tmo= shift;
|
||||
|
||||
my %mysql_admin_pids;
|
||||
|
||||
# Start one "mysqladmin shutdown" for each server
|
||||
foreach my $srv ( @$spec )
|
||||
{
|
||||
my $args;
|
||||
|
||||
mtr_init_args(\$args);
|
||||
|
||||
mtr_add_arg($args, "--no-defaults");
|
||||
mtr_add_arg($args, "--user=%s", $::opt_user);
|
||||
mtr_add_arg($args, "--password=");
|
||||
mtr_add_arg($args, "--silent");
|
||||
if ( -e $srv->{'sockfile'} )
|
||||
if ( -e $srv->{'path_sock'} )
|
||||
{
|
||||
mtr_add_arg($args, "--socket=%s", $srv->{'sockfile'});
|
||||
mtr_add_arg($args, "--socket=%s", $srv->{'path_sock'});
|
||||
}
|
||||
if ( $srv->{'port'} )
|
||||
{
|
||||
mtr_add_arg($args, "--port=%s", $srv->{'port'});
|
||||
}
|
||||
if ( $srv->{'port'} and ! -e $srv->{'sockfile'} )
|
||||
if ( $srv->{'port'} and ! -e $srv->{'path_sock'} )
|
||||
{
|
||||
mtr_add_arg($args, "--protocol=tcp"); # Needed if no --socket
|
||||
}
|
||||
mtr_add_arg($args, "--connect_timeout=5");
|
||||
|
||||
# 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");
|
||||
mtr_add_arg($args, "$command");
|
||||
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_mysqladmin_log, $path_mysqladmin_log, "",
|
||||
{ append_log_file => 1 });
|
||||
# Save the pid of the mysqladmin process
|
||||
$mysql_admin_pids{$pid}= 1;
|
||||
mtr_verbose("mtr_mysqladmin_start, pid: $pid");
|
||||
return $pid;
|
||||
|
||||
# We don't wait for termination of mysqladmin
|
||||
}
|
||||
}
|
||||
|
||||
# Wait for all the started mysqladmin to exit
|
||||
# As mysqladmin is such a simple program, we trust it to terminate.
|
||||
# I.e. we wait blocking, and wait wait for them all before we go on.
|
||||
foreach my $pid (keys %mysql_admin_pids)
|
||||
{
|
||||
my $ret_pid= waitpid($pid,0);
|
||||
# Start "ndb_mgm shutdown" for a specific cluster, it will
|
||||
# shutdown all data nodes and leave the ndb_mgmd running
|
||||
sub mtr_ndbmgm_start($$) {
|
||||
my $cluster= shift;
|
||||
my $command= shift;
|
||||
|
||||
# If this was any of the mysqladmin's we waited for, delete its
|
||||
# pid from list
|
||||
delete $mysql_admin_pids{$ret_pid} if exists $mysql_admin_pids{$ret_pid};
|
||||
}
|
||||
my $args;
|
||||
|
||||
# If we trusted "mysqladmin --shutdown_timeout= ..." we could just
|
||||
# terminate now, but we don't (FIXME should be debugged).
|
||||
# So we try again to ping and at least wait the same amount of time
|
||||
# mysqladmin would for all to die.
|
||||
mtr_init_args(\$args);
|
||||
|
||||
my $timeout= 20; # 20 seconds max
|
||||
mtr_add_arg($args, "--no-defaults");
|
||||
mtr_add_arg($args, "--core");
|
||||
mtr_add_arg($args, "--try-reconnect=1");
|
||||
mtr_add_arg($args, "--ndb_connectstring=%s", $cluster->{'connect_string'});
|
||||
mtr_add_arg($args, "-e");
|
||||
mtr_add_arg($args, "$command");
|
||||
|
||||
my $pid= mtr_spawn($::exe_ndb_mgm, $args,
|
||||
"", "/dev/null", "/dev/null", "",
|
||||
{});
|
||||
mtr_verbose("mtr_ndbmgm_start, pid: $pid");
|
||||
return $pid;
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Ping all servers in list, exit when none of them answers
|
||||
# or when timeout has passed
|
||||
sub mtr_ping_with_timeout($) {
|
||||
my $spec= shift;
|
||||
my $timeout= 200; # 20 seconds max
|
||||
my $res= 1; # If we just fall through, we are done
|
||||
# in the sense that the servers don't
|
||||
# listen to their ports any longer
|
||||
@ -711,10 +753,13 @@ sub mtr_mysqladmin_shutdown {
|
||||
foreach my $srv ( @$spec )
|
||||
{
|
||||
$res= 1; # We are optimistic
|
||||
if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) )
|
||||
if ( $srv->{'pid'} and mtr_ping_port($srv->{'port'}) )
|
||||
{
|
||||
mtr_debug("Sleep 1 second waiting for processes to stop using port");
|
||||
sleep(1); # One second
|
||||
mtr_verbose("waiting for process $srv->{'pid'} to stop ".
|
||||
"using port $srv->{'port'}");
|
||||
|
||||
# Millisceond sleep emulated with select
|
||||
select(undef, undef, undef, (0.1));
|
||||
$res= 0;
|
||||
next TIME;
|
||||
}
|
||||
@ -722,7 +767,7 @@ sub mtr_mysqladmin_shutdown {
|
||||
last; # If we got here, we are done
|
||||
}
|
||||
|
||||
$timeout or mtr_debug("At least one server is still listening to its port");
|
||||
$timeout or mtr_report("At least one server is still listening to its port");
|
||||
|
||||
return $res;
|
||||
}
|
||||
@ -743,12 +788,12 @@ sub mtr_record_dead_children () {
|
||||
# -1 or 0 means there are no more procesess to wait for
|
||||
while ( ($ret_pid= waitpid(-1,&WNOHANG)) != 0 and $ret_pid != -1)
|
||||
{
|
||||
mtr_debug("waitpid() catched exit of child $ret_pid");
|
||||
mtr_warning("waitpid() caught exit of child $ret_pid");
|
||||
foreach my $idx (0..1)
|
||||
{
|
||||
if ( $::master->[$idx]->{'pid'} eq $ret_pid )
|
||||
{
|
||||
mtr_debug("child $ret_pid was master[$idx]");
|
||||
mtr_warning("child $ret_pid was master[$idx]");
|
||||
$::master->[$idx]->{'pid'}= 0;
|
||||
}
|
||||
}
|
||||
@ -757,11 +802,31 @@ sub mtr_record_dead_children () {
|
||||
{
|
||||
if ( $::slave->[$idx]->{'pid'} eq $ret_pid )
|
||||
{
|
||||
mtr_debug("child $ret_pid was slave[$idx]");
|
||||
mtr_warning("child $ret_pid was slave[$idx]");
|
||||
$::slave->[$idx]->{'pid'}= 0;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $cluster (@{$::clusters})
|
||||
{
|
||||
if ( $cluster->{'pid'} eq $ret_pid )
|
||||
{
|
||||
mtr_warning("child $ret_pid was $cluster->{'name'} cluster ndb_mgmd");
|
||||
$cluster->{'pid'}= 0;
|
||||
last;
|
||||
}
|
||||
|
||||
foreach my $ndbd (@{$cluster->{'ndbds'}})
|
||||
{
|
||||
if ( $ndbd->{'pid'} eq $ret_pid )
|
||||
{
|
||||
mtr_warning("child $ret_pid was $cluster->{'name'} cluster ndbd");
|
||||
$ndbd->{'pid'}= 0;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -785,7 +850,8 @@ sub stop_reap_all {
|
||||
$SIG{CHLD}= 'DEFAULT';
|
||||
}
|
||||
|
||||
sub mtr_ping_mysqld_server () {
|
||||
|
||||
sub mtr_ping_port ($) {
|
||||
my $port= shift;
|
||||
|
||||
my $remote= "localhost";
|
||||
@ -839,12 +905,11 @@ sub sleep_until_file_created ($$$) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
mtr_debug("Sleep $sleeptime milliseconds waiting for ".
|
||||
"creation of $pidfile");
|
||||
mtr_debug("Sleep $sleeptime milliseconds waiting for $pidfile");
|
||||
|
||||
# Print extra message every 60 seconds
|
||||
my $seconds= ($loop * $sleeptime) / 1000;
|
||||
if ( $seconds > 1 and $seconds % 60 == 0 )
|
||||
if ( $seconds > 1 and int($seconds) % 60 == 0 )
|
||||
{
|
||||
my $left= $timeout - $seconds;
|
||||
mtr_warning("Waited $seconds seconds for $pidfile to be created, " .
|
||||
@ -862,16 +927,13 @@ sub sleep_until_file_created ($$$) {
|
||||
sub mtr_kill_processes ($) {
|
||||
my $pids = shift;
|
||||
|
||||
mtr_verbose("mtr_kill_processes " . join(" ", @$pids));
|
||||
|
||||
foreach my $pid (@$pids)
|
||||
{
|
||||
foreach my $sig (15, 9)
|
||||
{
|
||||
my $retries= 10;
|
||||
while (1)
|
||||
{
|
||||
kill($sig, @{$pids});
|
||||
last unless kill (0, @{$pids}) and $retries--;
|
||||
|
||||
mtr_debug("Sleep 2 second waiting for processes to die");
|
||||
sleep(2);
|
||||
last if mtr_kill_process($pid, $sig, 10, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -882,17 +944,20 @@ sub mtr_kill_process ($$$$) {
|
||||
my $signal= shift;
|
||||
my $retries= shift;
|
||||
my $timeout= shift;
|
||||
my $max_loop= $timeout*10; # Sleeping 0.1 between each kill attempt
|
||||
|
||||
while (1)
|
||||
{
|
||||
kill($signal, $pid);
|
||||
|
||||
last unless kill (0, $pid) and $retries--;
|
||||
last unless kill (0, $pid) and $max_loop--;
|
||||
|
||||
mtr_debug("Sleep $timeout second waiting for processes to die");
|
||||
mtr_verbose("Sleep 0.1 second waiting for processes to die");
|
||||
|
||||
sleep($timeout);
|
||||
select(undef, undef, undef, 0.1);
|
||||
}
|
||||
|
||||
return $max_loop;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
@ -904,7 +969,7 @@ sub mtr_kill_process ($$$$) {
|
||||
# FIXME something is wrong, we sometimes terminate with "Hangup" written
|
||||
# to tty, and no STDERR output telling us why.
|
||||
|
||||
# FIXME for some readon, setting HUP to 'IGNORE' will cause exit() to
|
||||
# FIXME for some reason, setting HUP to 'IGNORE' will cause exit() to
|
||||
# write out "Hangup", and maybe loose some output. We insert a sleep...
|
||||
|
||||
sub mtr_exit ($) {
|
||||
|
@ -21,6 +21,7 @@ sub mtr_warning (@);
|
||||
sub mtr_error (@);
|
||||
sub mtr_child_error (@);
|
||||
sub mtr_debug (@);
|
||||
sub mtr_verbose (@);
|
||||
|
||||
|
||||
##############################################################################
|
||||
@ -122,7 +123,7 @@ sub mtr_report_test_failed ($) {
|
||||
{
|
||||
print "[ fail ] timeout\n";
|
||||
}
|
||||
elsif ( $tinfo->{'ndb_test'} and !$::flag_ndb_status_ok)
|
||||
elsif ( $tinfo->{'ndb_test'} and $::cluster->[0]->{'installed_ok'} eq "NO")
|
||||
{
|
||||
print "[ fail ] ndbcluster start failure\n";
|
||||
return;
|
||||
@ -157,6 +158,7 @@ sub mtr_report_stats ($) {
|
||||
my $tot_passed= 0;
|
||||
my $tot_failed= 0;
|
||||
my $tot_tests= 0;
|
||||
my $tot_restarts= 0;
|
||||
my $found_problems= 0; # Some warnings are errors...
|
||||
|
||||
foreach my $tinfo (@$tests)
|
||||
@ -175,6 +177,10 @@ sub mtr_report_stats ($) {
|
||||
$tot_tests++;
|
||||
$tot_failed++;
|
||||
}
|
||||
if ( $tinfo->{'restarted'} )
|
||||
{
|
||||
$tot_restarts++;
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
@ -197,6 +203,8 @@ sub mtr_report_stats ($) {
|
||||
"the documentation at\n",
|
||||
"http://www.mysql.com/doc/en/MySQL_test_suite.html\n";
|
||||
}
|
||||
print
|
||||
"The servers were restarted $tot_restarts times\n";
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# If a debug run, there might be interesting information inside
|
||||
@ -335,5 +343,11 @@ sub mtr_debug (@) {
|
||||
print STDERR "####: ",join(" ", @_),"\n";
|
||||
}
|
||||
}
|
||||
sub mtr_verbose (@) {
|
||||
if ( $::opt_verbose )
|
||||
{
|
||||
print STDERR "> ",join(" ", @_),"\n";
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -27,8 +27,7 @@ sub run_stress_test ()
|
||||
|
||||
if ( ! $::glob_use_embedded_server and ! $::opt_local_master )
|
||||
{
|
||||
$::master->[0]->{'pid'}= mysqld_start('master',0,[],[],0);
|
||||
if ( ! $::master->[0]->{'pid'} )
|
||||
if ( ! mysqld_start($::master->[0],[],[]) )
|
||||
{
|
||||
mtr_error("Can't start the mysqld server");
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -780,12 +780,6 @@ t1 CREATE TABLE `t1` (
|
||||
`i` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295
|
||||
drop table t1;
|
||||
create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
|
||||
character set utf8 collate utf8_general_ci;
|
||||
Warnings:
|
||||
Warning 1071 Specified key was too long; max key length is 765 bytes
|
||||
insert into t1 values('aaa');
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
insert into t1 values (1,1),(1,2);
|
||||
CREATE TABLE t2 (primary key (a)) select * from t1;
|
||||
|
@ -653,15 +653,6 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range k2 k2 4 NULL 6 Using where; Using index
|
||||
1 SIMPLE t1 index NULL PRIMARY 3 NULL 15 Using index
|
||||
drop table t1, t2;
|
||||
create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
|
||||
insert into t1 values (1, 3);
|
||||
select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
|
||||
count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ
|
||||
1
|
||||
select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
|
||||
Case When Count(*) < MAX_REQ Then 1 Else 0 End
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (a char(10));
|
||||
insert into t1 values ('a'),('b'),('c');
|
||||
select coercibility(max(a)) from t1;
|
||||
|
147
mysql-test/r/func_group_innodb.result
Normal file
147
mysql-test/r/func_group_innodb.result
Normal file
@ -0,0 +1,147 @@
|
||||
create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
|
||||
insert into t1 values (1, 3);
|
||||
select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
|
||||
count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ
|
||||
1
|
||||
select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
|
||||
Case When Count(*) < MAX_REQ Then 1 Else 0 End
|
||||
1
|
||||
drop table t1;
|
||||
create table t1m (a int) engine=myisam;
|
||||
create table t1i (a int) engine=innodb;
|
||||
create table t2m (a int) engine=myisam;
|
||||
create table t2i (a int) engine=innodb;
|
||||
insert into t2m values (5);
|
||||
insert into t2i values (5);
|
||||
select min(a) from t1m;
|
||||
min(a)
|
||||
NULL
|
||||
select min(7) from t1m;
|
||||
min(7)
|
||||
NULL
|
||||
select min(7) from DUAL;
|
||||
min(7)
|
||||
NULL
|
||||
explain select min(7) from t2m join t1m;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
select min(7) from t2m join t1m;
|
||||
min(7)
|
||||
NULL
|
||||
select max(a) from t1m;
|
||||
max(a)
|
||||
NULL
|
||||
select max(7) from t1m;
|
||||
max(7)
|
||||
NULL
|
||||
select max(7) from DUAL;
|
||||
max(7)
|
||||
NULL
|
||||
explain select max(7) from t2m join t1m;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
select max(7) from t2m join t1m;
|
||||
max(7)
|
||||
NULL
|
||||
select 1, min(a) from t1m where a=99;
|
||||
1 min(a)
|
||||
1 NULL
|
||||
select 1, min(a) from t1m where 1=99;
|
||||
1 min(a)
|
||||
1 NULL
|
||||
select 1, min(1) from t1m where a=99;
|
||||
1 min(1)
|
||||
1 NULL
|
||||
select 1, min(1) from t1m where 1=99;
|
||||
1 min(1)
|
||||
1 NULL
|
||||
select 1, max(a) from t1m where a=99;
|
||||
1 max(a)
|
||||
1 NULL
|
||||
select 1, max(a) from t1m where 1=99;
|
||||
1 max(a)
|
||||
1 NULL
|
||||
select 1, max(1) from t1m where a=99;
|
||||
1 max(1)
|
||||
1 NULL
|
||||
select 1, max(1) from t1m where 1=99;
|
||||
1 max(1)
|
||||
1 NULL
|
||||
select min(a) from t1i;
|
||||
min(a)
|
||||
NULL
|
||||
select min(7) from t1i;
|
||||
min(7)
|
||||
NULL
|
||||
select min(7) from DUAL;
|
||||
min(7)
|
||||
NULL
|
||||
explain select min(7) from t2i join t1i;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
|
||||
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
|
||||
select min(7) from t2i join t1i;
|
||||
min(7)
|
||||
NULL
|
||||
select max(a) from t1i;
|
||||
max(a)
|
||||
NULL
|
||||
select max(7) from t1i;
|
||||
max(7)
|
||||
NULL
|
||||
select max(7) from DUAL;
|
||||
max(7)
|
||||
NULL
|
||||
explain select max(7) from t2i join t1i;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
|
||||
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
|
||||
select max(7) from t2i join t1i;
|
||||
max(7)
|
||||
NULL
|
||||
select 1, min(a) from t1i where a=99;
|
||||
1 min(a)
|
||||
1 NULL
|
||||
select 1, min(a) from t1i where 1=99;
|
||||
1 min(a)
|
||||
1 NULL
|
||||
select 1, min(1) from t1i where a=99;
|
||||
1 min(1)
|
||||
1 NULL
|
||||
select 1, min(1) from t1i where 1=99;
|
||||
1 min(1)
|
||||
1 NULL
|
||||
select 1, max(a) from t1i where a=99;
|
||||
1 max(a)
|
||||
1 NULL
|
||||
select 1, max(a) from t1i where 1=99;
|
||||
1 max(a)
|
||||
1 NULL
|
||||
select 1, max(1) from t1i where a=99;
|
||||
1 max(1)
|
||||
1 NULL
|
||||
select 1, max(1) from t1i where 1=99;
|
||||
1 max(1)
|
||||
1 NULL
|
||||
explain select count(*), min(7), max(7) from t1m, t1i;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
|
||||
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
|
||||
select count(*), min(7), max(7) from t1m, t1i;
|
||||
count(*) min(7) max(7)
|
||||
0 NULL NULL
|
||||
explain select count(*), min(7), max(7) from t1m, t2i;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
|
||||
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
|
||||
select count(*), min(7), max(7) from t1m, t2i;
|
||||
count(*) min(7) max(7)
|
||||
0 NULL NULL
|
||||
explain select count(*), min(7), max(7) from t2m, t1i;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2m system NULL NULL NULL NULL 1
|
||||
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
|
||||
select count(*), min(7), max(7) from t2m, t1i;
|
||||
count(*) min(7) max(7)
|
||||
0 NULL NULL
|
||||
drop table t1m, t1i, t2m, t2i;
|
72
mysql-test/r/group_min_max_innodb.result
Normal file
72
mysql-test/r/group_min_max_innodb.result
Normal file
@ -0,0 +1,72 @@
|
||||
create table t4 (
|
||||
pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
|
||||
) engine=innodb;
|
||||
insert into t4 (a1, a2, b, c, d) values
|
||||
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
|
||||
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
|
||||
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
|
||||
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
|
||||
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
|
||||
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
|
||||
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
|
||||
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
|
||||
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
|
||||
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
|
||||
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
|
||||
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
|
||||
('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
|
||||
('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
|
||||
('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
|
||||
('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
|
||||
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
|
||||
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
|
||||
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
|
||||
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
|
||||
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
|
||||
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
|
||||
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
|
||||
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
|
||||
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
|
||||
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
|
||||
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
|
||||
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
|
||||
('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
|
||||
('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
|
||||
('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
|
||||
('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
|
||||
create index idx12672_0 on t4 (a1);
|
||||
create index idx12672_1 on t4 (a1,a2,b,c);
|
||||
create index idx12672_2 on t4 (a1,a2,b);
|
||||
analyze table t4;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t4 analyze status OK
|
||||
select distinct a1 from t4 where pk_col not in (1,2,3,4);
|
||||
a1
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
drop table t4;
|
||||
create table t1 (
|
||||
a varchar(30), b varchar(30), primary key(a), key(b)
|
||||
) engine=innodb;
|
||||
select distinct a from t1;
|
||||
a
|
||||
drop table t1;
|
||||
create table t1(a int, key(a)) engine=innodb;
|
||||
insert into t1 values(1);
|
||||
select a, count(a) from t1 group by a with rollup;
|
||||
a count(a)
|
||||
1 1
|
||||
NULL 1
|
||||
drop table t1;
|
||||
create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb;
|
||||
insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
|
||||
alter table t1 drop primary key, add primary key (f2, f1);
|
||||
explain select distinct f1 a, f1 b from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary
|
||||
explain select distinct f1, f2 from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
|
||||
drop table t1;
|
@ -326,3 +326,9 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
SELECT * from t2;
|
||||
a b
|
||||
drop table t1,t2;
|
||||
create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
|
||||
character set utf8 collate utf8_general_ci;
|
||||
Warnings:
|
||||
Warning 1071 Specified key was too long; max key length is 765 bytes
|
||||
insert into t1 values('aaa');
|
||||
drop table t1;
|
||||
|
@ -1135,25 +1135,6 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 4 Using where
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
|
||||
INDEX (name)) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
|
||||
FOREIGN KEY (fkey) REFERENCES t2(id)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
|
||||
INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
|
||||
WHERE t1.name LIKE 'A%';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index PRIMARY,name name 23 NULL 3 Using where; Using index
|
||||
1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using where; Using index
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
|
||||
WHERE t1.name LIKE 'A%' OR FALSE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 index NULL fkey 5 NULL 5 Using index
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.fkey 1 Using where
|
||||
DROP TABLE t1,t2;
|
||||
DROP VIEW IF EXISTS v1,v2;
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
CREATE TABLE t1 (a int);
|
||||
|
19
mysql-test/r/join_outer_innodb.result
Normal file
19
mysql-test/r/join_outer_innodb.result
Normal file
@ -0,0 +1,19 @@
|
||||
CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
|
||||
INDEX (name)) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
|
||||
FOREIGN KEY (fkey) REFERENCES t2(id)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
|
||||
INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
|
||||
WHERE t1.name LIKE 'A%';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index PRIMARY,name name 23 NULL 3 Using where; Using index
|
||||
1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using where; Using index
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
|
||||
WHERE t1.name LIKE 'A%' OR FALSE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index PRIMARY,name name 23 NULL 3 Using where; Using index
|
||||
1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using where; Using index
|
||||
DROP TABLE t1,t2;
|
@ -70,3 +70,5 @@ show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
drop table t1, t2;
|
||||
set GLOBAL query_cache_size=0;
|
||||
set GLOBAL query_cache_size=0;
|
||||
|
@ -660,11 +660,6 @@ partition by list (a)
|
||||
alter table t1 rebuild partition;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
|
||||
drop table t1;
|
||||
create table t1 (a int) engine=innodb partition by hash(a) ;
|
||||
show table status like 't1';
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||
drop table t1;
|
||||
create table t2 (s1 int not null auto_increment, primary key (s1)) partition by list (s1) (partition p1 values in (1),partition p2 values in (2),partition p3 values in (3),partition p4 values in (4));
|
||||
insert into t2 values (null),(null),(null);
|
||||
select * from t2;
|
||||
@ -739,6 +734,7 @@ CALL test.p1(13);
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
drop table t1;
|
||||
drop procedure test.p1;
|
||||
CREATE TABLE t1 (a int not null)
|
||||
partition by key(a)
|
||||
(partition p0 COMMENT='first partition');
|
||||
|
5
mysql-test/r/partition_innodb.result
Normal file
5
mysql-test/r/partition_innodb.result
Normal file
@ -0,0 +1,5 @@
|
||||
create table t1 (a int) engine=innodb partition by hash(a) ;
|
||||
show table status like 't1';
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||
drop table t1;
|
@ -33,3 +33,5 @@ n
|
||||
1234
|
||||
DROP DATABASE mysqltest1;
|
||||
stop slave;
|
||||
use test;
|
||||
drop table t1;
|
||||
|
@ -73,3 +73,4 @@ CREATE TABLE t1 ( a INT UNIQUE );
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
INSERT INTO t1 VALUES (1),(1);
|
||||
Got one of the listed errors
|
||||
drop table t1;
|
||||
|
@ -79,3 +79,4 @@ terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
|
||||
ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
|
||||
drop table t2;
|
||||
drop table t2;
|
||||
drop table t1;
|
||||
|
@ -194,3 +194,4 @@ idpro price nbprice
|
||||
1 1.0000 3
|
||||
2 1.0000 2
|
||||
3 2.0000 1
|
||||
DROP TABLE t1, t2;
|
||||
|
@ -194,3 +194,4 @@ idpro price nbprice
|
||||
1 1.0000 3
|
||||
2 1.0000 2
|
||||
3 2.0000 1
|
||||
DROP TABLE t1, t2;
|
||||
|
@ -43,3 +43,4 @@ DROP PROCEDURE IF EXISTS mysqltest1.p1;
|
||||
DROP PROCEDURE IF EXISTS mysqltest1.p2;
|
||||
DROP TABLE IF EXISTS mysqltest1.t1;
|
||||
DROP TABLE IF EXISTS mysqltest1.t2;
|
||||
DROP DATABASE mysqltest1;
|
||||
|
@ -43,3 +43,4 @@ DROP PROCEDURE IF EXISTS mysqltest1.p1;
|
||||
DROP PROCEDURE IF EXISTS mysqltest1.p2;
|
||||
DROP TABLE IF EXISTS mysqltest1.t1;
|
||||
DROP TABLE IF EXISTS mysqltest1.t2;
|
||||
DROP DATABASE mysqltest1;
|
||||
|
@ -49,4 +49,4 @@ select * from t1;
|
||||
a b
|
||||
select * from t2;
|
||||
a b
|
||||
drop table t1;
|
||||
drop table t1, t2;
|
||||
|
@ -15,3 +15,4 @@ slave_load_tmpdir SLAVE_LOAD_TMPDIR
|
||||
show variables like 'slave_skip_errors';
|
||||
Variable_name Value
|
||||
slave_skip_errors 3,100,137,643,1752
|
||||
set global slave_net_timeout=default;
|
||||
|
@ -314,16 +314,6 @@ select * from db_bug14533.t1;
|
||||
ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table 't1'
|
||||
drop user user_bug14533@localhost;
|
||||
drop database db_bug14533;
|
||||
CREATE DATABASE db_bug7787;
|
||||
use db_bug7787;
|
||||
CREATE PROCEDURE p1()
|
||||
SHOW INNODB STATUS;
|
||||
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
|
||||
DROP DATABASE IF EXISTS mysqltest;
|
||||
|
@ -4796,22 +4796,6 @@ i
|
||||
0
|
||||
drop table t3|
|
||||
drop procedure bug16887|
|
||||
create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb|
|
||||
insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')|
|
||||
CREATE FUNCTION bug13575 ( p1 integer )
|
||||
returns varchar(3)
|
||||
BEGIN
|
||||
DECLARE v1 VARCHAR(10) DEFAULT null;
|
||||
SELECT f2 INTO v1 FROM t3 WHERE f1 = p1;
|
||||
RETURN v1;
|
||||
END|
|
||||
select distinct f1, bug13575(f1) from t3 order by f1|
|
||||
f1 bug13575(f1)
|
||||
1 aaa
|
||||
2 bbb
|
||||
3 ccc
|
||||
drop function bug13575;
|
||||
drop table t3|
|
||||
drop procedure if exists bug16474_1|
|
||||
drop procedure if exists bug16474_2|
|
||||
delete from t1|
|
||||
|
@ -530,3 +530,29 @@ count(*)
|
||||
drop table t3, t4|
|
||||
drop procedure bug14210|
|
||||
set @@session.max_heap_table_size=default|
|
||||
CREATE DATABASE db_bug7787|
|
||||
use db_bug7787|
|
||||
CREATE PROCEDURE p1()
|
||||
SHOW INNODB STATUS; |
|
||||
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|
|
||||
create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb|
|
||||
insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')|
|
||||
CREATE FUNCTION bug13575 ( p1 integer )
|
||||
returns varchar(3)
|
||||
BEGIN
|
||||
DECLARE v1 VARCHAR(10) DEFAULT null;
|
||||
SELECT f2 INTO v1 FROM t3 WHERE f1 = p1;
|
||||
RETURN v1;
|
||||
END|
|
||||
select distinct f1, bug13575(f1) from t3 order by f1|
|
||||
f1 bug13575(f1)
|
||||
1 aaa
|
||||
2 bbb
|
||||
3 ccc
|
||||
drop function bug13575|
|
||||
drop table t3|
|
||||
|
@ -670,13 +670,6 @@ alter table t1 max_rows=100000000000;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#17530: Incorrect key truncation on table creation caused server crash.
|
||||
#
|
||||
create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
|
||||
character set utf8 collate utf8_general_ci;
|
||||
insert into t1 values('aaa');
|
||||
drop table t1;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
||||
|
@ -378,13 +378,15 @@ explain
|
||||
select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME';
|
||||
drop table t1, t2;
|
||||
|
||||
--disable_warnings
|
||||
create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
|
||||
--enable_warnings
|
||||
insert into t1 values (1, 3);
|
||||
select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
|
||||
select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
|
||||
drop table t1;
|
||||
# Moved to func_group_innodb
|
||||
#--disable_warnings
|
||||
#create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
|
||||
#--enable_warnings
|
||||
#insert into t1 values (1, 3);
|
||||
#select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
|
||||
#select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
|
||||
#drop table t1;
|
||||
|
||||
|
||||
create table t1 (a char(10));
|
||||
insert into t1 values ('a'),('b'),('c');
|
||||
@ -539,6 +541,11 @@ INSERT INTO t1 VALUES
|
||||
SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug #12882 min/max inconsistent on empty table
|
||||
#
|
||||
# Test case moved to func_group_innodb
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
85
mysql-test/t/func_group_innodb.test
Normal file
85
mysql-test/t/func_group_innodb.test
Normal file
@ -0,0 +1,85 @@
|
||||
#
|
||||
# Test of group functions that depend on innodb
|
||||
#
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--disable_warnings
|
||||
create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
|
||||
--enable_warnings
|
||||
insert into t1 values (1, 3);
|
||||
select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
|
||||
select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug #12882 min/max inconsistent on empty table
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
create table t1m (a int) engine=myisam;
|
||||
create table t1i (a int) engine=innodb;
|
||||
create table t2m (a int) engine=myisam;
|
||||
create table t2i (a int) engine=innodb;
|
||||
--enable_warnings
|
||||
insert into t2m values (5);
|
||||
insert into t2i values (5);
|
||||
|
||||
# test with MyISAM
|
||||
select min(a) from t1m;
|
||||
select min(7) from t1m;
|
||||
select min(7) from DUAL;
|
||||
explain select min(7) from t2m join t1m;
|
||||
select min(7) from t2m join t1m;
|
||||
|
||||
select max(a) from t1m;
|
||||
select max(7) from t1m;
|
||||
select max(7) from DUAL;
|
||||
explain select max(7) from t2m join t1m;
|
||||
select max(7) from t2m join t1m;
|
||||
|
||||
select 1, min(a) from t1m where a=99;
|
||||
select 1, min(a) from t1m where 1=99;
|
||||
select 1, min(1) from t1m where a=99;
|
||||
select 1, min(1) from t1m where 1=99;
|
||||
|
||||
select 1, max(a) from t1m where a=99;
|
||||
select 1, max(a) from t1m where 1=99;
|
||||
select 1, max(1) from t1m where a=99;
|
||||
select 1, max(1) from t1m where 1=99;
|
||||
|
||||
# test with InnoDB
|
||||
select min(a) from t1i;
|
||||
select min(7) from t1i;
|
||||
select min(7) from DUAL;
|
||||
explain select min(7) from t2i join t1i;
|
||||
select min(7) from t2i join t1i;
|
||||
|
||||
select max(a) from t1i;
|
||||
select max(7) from t1i;
|
||||
select max(7) from DUAL;
|
||||
explain select max(7) from t2i join t1i;
|
||||
select max(7) from t2i join t1i;
|
||||
|
||||
select 1, min(a) from t1i where a=99;
|
||||
select 1, min(a) from t1i where 1=99;
|
||||
select 1, min(1) from t1i where a=99;
|
||||
select 1, min(1) from t1i where 1=99;
|
||||
|
||||
select 1, max(a) from t1i where a=99;
|
||||
select 1, max(a) from t1i where 1=99;
|
||||
select 1, max(1) from t1i where a=99;
|
||||
select 1, max(1) from t1i where 1=99;
|
||||
|
||||
# mixed MyISAM/InnoDB test
|
||||
explain select count(*), min(7), max(7) from t1m, t1i;
|
||||
select count(*), min(7), max(7) from t1m, t1i;
|
||||
|
||||
explain select count(*), min(7), max(7) from t1m, t2i;
|
||||
select count(*), min(7), max(7) from t1m, t2i;
|
||||
|
||||
explain select count(*), min(7), max(7) from t2m, t1i;
|
||||
select count(*), min(7), max(7) from t2m, t1i;
|
||||
|
||||
drop table t1m, t1i, t2m, t2i;
|
@ -659,7 +659,30 @@ select a1 from t1 where a2 = 'b' group by a1;
|
||||
explain select distinct a1 from t1 where a2 = 'b';
|
||||
select distinct a1 from t1 where a2 = 'b';
|
||||
|
||||
drop table t1,t2,t3;
|
||||
#
|
||||
# Bug #12672: primary key implcitly included in every innodb index
|
||||
#
|
||||
# Test case moved to group_min_max_innodb
|
||||
|
||||
|
||||
#
|
||||
# Bug #6142: a problem with the empty innodb table
|
||||
#
|
||||
# Test case moved to group_min_max_innodb
|
||||
|
||||
|
||||
#
|
||||
# Bug #9798: group by with rollup
|
||||
#
|
||||
# Test case moved to group_min_max_innodb
|
||||
|
||||
|
||||
#
|
||||
# Bug #13293 Wrongly used index results in endless loop.
|
||||
#
|
||||
# Test case moved to group_min_max_innodb
|
||||
|
||||
|
||||
#
|
||||
# Bug #14920 Ordering aggregated result sets with composite primary keys
|
||||
# corrupts resultset
|
||||
|
95
mysql-test/t/group_min_max_innodb.test
Normal file
95
mysql-test/t/group_min_max_innodb.test
Normal file
@ -0,0 +1,95 @@
|
||||
#
|
||||
# Test file for WL#1724 (Min/Max Optimization for Queries with Group By Clause).
|
||||
# The queries in this file test query execution via QUICK_GROUP_MIN_MAX_SELECT
|
||||
# that depends on InnoDB
|
||||
#
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
#
|
||||
# Bug #12672: primary key implcitly included in every innodb index
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
create table t4 (
|
||||
pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
|
||||
) engine=innodb;
|
||||
--enable_warnings
|
||||
|
||||
insert into t4 (a1, a2, b, c, d) values
|
||||
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
|
||||
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
|
||||
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
|
||||
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
|
||||
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
|
||||
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
|
||||
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
|
||||
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
|
||||
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
|
||||
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
|
||||
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
|
||||
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
|
||||
('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
|
||||
('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
|
||||
('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
|
||||
('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
|
||||
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
|
||||
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
|
||||
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
|
||||
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
|
||||
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
|
||||
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
|
||||
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
|
||||
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
|
||||
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
|
||||
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
|
||||
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
|
||||
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
|
||||
('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
|
||||
('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
|
||||
('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
|
||||
('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
|
||||
|
||||
create index idx12672_0 on t4 (a1);
|
||||
create index idx12672_1 on t4 (a1,a2,b,c);
|
||||
create index idx12672_2 on t4 (a1,a2,b);
|
||||
analyze table t4;
|
||||
|
||||
select distinct a1 from t4 where pk_col not in (1,2,3,4);
|
||||
|
||||
drop table t4;
|
||||
|
||||
|
||||
#
|
||||
# Bug #6142: a problem with the empty innodb table
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
create table t1 (
|
||||
a varchar(30), b varchar(30), primary key(a), key(b)
|
||||
) engine=innodb;
|
||||
--enable_warnings
|
||||
select distinct a from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #9798: group by with rollup
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
create table t1(a int, key(a)) engine=innodb;
|
||||
--enable_warnings
|
||||
insert into t1 values(1);
|
||||
select a, count(a) from t1 group by a with rollup;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug #13293 Wrongly used index results in endless loop.
|
||||
#
|
||||
create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb;
|
||||
insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
|
||||
alter table t1 drop primary key, add primary key (f2, f1);
|
||||
explain select distinct f1 a, f1 b from t1;
|
||||
explain select distinct f1, f2 from t1;
|
||||
drop table t1;
|
@ -272,3 +272,11 @@ TRUNCATE table t2;
|
||||
INSERT INTO t2 select * from t1;
|
||||
SELECT * from t2;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug#17530: Incorrect key truncation on table creation caused server crash.
|
||||
#
|
||||
create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
|
||||
character set utf8 collate utf8_general_ci;
|
||||
insert into t1 values('aaa');
|
||||
drop table t1;
|
||||
|
@ -763,22 +763,8 @@ DROP TABLE t1,t2;
|
||||
# Test for bug #17164: ORed FALSE blocked conversion of outer join into join
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
|
||||
INDEX (name)) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
|
||||
FOREIGN KEY (fkey) REFERENCES t2(id)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
|
||||
INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
|
||||
# Test case moved to join_outer_innodb
|
||||
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
|
||||
WHERE t1.name LIKE 'A%';
|
||||
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
|
||||
WHERE t1.name LIKE 'A%' OR FALSE;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Bug 19396: LEFT OUTER JOIN over views in curly braces
|
||||
|
26
mysql-test/t/join_outer_innodb.test
Normal file
26
mysql-test/t/join_outer_innodb.test
Normal file
@ -0,0 +1,26 @@
|
||||
#
|
||||
# test of left outer join for tests that depends on innodb
|
||||
#
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
#
|
||||
# Test for bug #17164: ORed FALSE blocked conversion of outer join into join
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
|
||||
INDEX (name)) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
|
||||
FOREIGN KEY (fkey) REFERENCES t2(id)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
|
||||
INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
|
||||
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
|
||||
WHERE t1.name LIKE 'A%';
|
||||
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
|
||||
WHERE t1.name LIKE 'A%' OR FALSE;
|
||||
|
||||
DROP TABLE t1,t2;
|
@ -63,3 +63,10 @@ show status like "Qcache_hits";
|
||||
drop table t1, t2;
|
||||
|
||||
|
||||
# Turn off query cache on server1
|
||||
connection server1;
|
||||
set GLOBAL query_cache_size=0;
|
||||
|
||||
# Turn off query cache on server2
|
||||
connection server2;
|
||||
set GLOBAL query_cache_size=0;
|
||||
|
@ -769,13 +769,6 @@ alter table t1 rebuild partition;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #14673: Wrong InnoDB default row format
|
||||
#
|
||||
create table t1 (a int) engine=innodb partition by hash(a) ;
|
||||
show table status like 't1';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #14526: Partitions: indexed searches fail
|
||||
#
|
||||
@ -866,6 +859,7 @@ delimiter ;|
|
||||
CALL test.p1(12);
|
||||
CALL test.p1(13);
|
||||
drop table t1;
|
||||
drop procedure test.p1;
|
||||
|
||||
#
|
||||
# Bug 13520: Problem with delimiters in COMMENT DATA DIRECTORY ..
|
||||
|
9
mysql-test/t/partition_innodb.test
Normal file
9
mysql-test/t/partition_innodb.test
Normal file
@ -0,0 +1,9 @@
|
||||
--source include/have_innodb.inc
|
||||
|
||||
#
|
||||
# Bug #14673: Wrong InnoDB default row format
|
||||
#
|
||||
create table t1 (a int) engine=innodb partition by hash(a) ;
|
||||
show table status like 't1';
|
||||
drop table t1;
|
||||
|
@ -56,3 +56,7 @@ connection slave;
|
||||
stop slave;
|
||||
#system rm -rf $MYSQLTEST_VARDIR/master-data/mysqltest1;
|
||||
|
||||
connection master;
|
||||
use test;
|
||||
drop table t1;
|
||||
|
||||
|
@ -89,5 +89,5 @@ select * from t2;
|
||||
|
||||
# cleanup
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop table t1, t2;
|
||||
sync_slave_with_master;
|
||||
|
@ -12,3 +12,6 @@ show variables like 'slave_load_tmpdir';
|
||||
# We just set some arbitrary values in variables-master.opt so we can test
|
||||
# that a list of values works correctly
|
||||
show variables like 'slave_skip_errors';
|
||||
|
||||
# Cleanup
|
||||
set global slave_net_timeout=default;
|
||||
|
@ -526,29 +526,6 @@ drop user user_bug14533@localhost;
|
||||
drop database db_bug14533;
|
||||
|
||||
|
||||
#
|
||||
# BUG#7787: Stored procedures: improper warning for "grant execute" statement
|
||||
#
|
||||
|
||||
# Prepare.
|
||||
|
||||
CREATE DATABASE db_bug7787;
|
||||
use db_bug7787;
|
||||
|
||||
# Test.
|
||||
|
||||
CREATE PROCEDURE p1()
|
||||
SHOW INNODB STATUS;
|
||||
|
||||
GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost;
|
||||
|
||||
# Cleanup.
|
||||
|
||||
DROP DATABASE db_bug7787;
|
||||
drop user user_bug7787@localhost;
|
||||
use test;
|
||||
|
||||
|
||||
#
|
||||
# WL#2897: Complete definer support in the stored routines.
|
||||
#
|
||||
|
@ -5636,23 +5636,6 @@ call bug16887()|
|
||||
drop table t3|
|
||||
drop procedure bug16887|
|
||||
|
||||
#
|
||||
# Bug#13575 SP funcs in select with distinct/group and order by can
|
||||
# produce bad data
|
||||
#
|
||||
create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb|
|
||||
insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')|
|
||||
CREATE FUNCTION bug13575 ( p1 integer )
|
||||
returns varchar(3)
|
||||
BEGIN
|
||||
DECLARE v1 VARCHAR(10) DEFAULT null;
|
||||
SELECT f2 INTO v1 FROM t3 WHERE f1 = p1;
|
||||
RETURN v1;
|
||||
END|
|
||||
select distinct f1, bug13575(f1) from t3 order by f1|
|
||||
drop function bug13575;
|
||||
drop table t3|
|
||||
|
||||
#
|
||||
# BUG#16474: SP crashed MySQL
|
||||
# (when using "order by localvar", where 'localvar' is just that.
|
||||
|
@ -552,6 +552,45 @@ drop table t3, t4|
|
||||
drop procedure bug14210|
|
||||
set @@session.max_heap_table_size=default|
|
||||
|
||||
#
|
||||
# BUG#7787: Stored procedures: improper warning for "grant execute" statement
|
||||
#
|
||||
|
||||
# Prepare.
|
||||
|
||||
CREATE DATABASE db_bug7787|
|
||||
use db_bug7787|
|
||||
|
||||
# Test.
|
||||
|
||||
CREATE PROCEDURE p1()
|
||||
SHOW INNODB STATUS; |
|
||||
|
||||
GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost|
|
||||
|
||||
# Cleanup.
|
||||
|
||||
DROP DATABASE db_bug7787|
|
||||
drop user user_bug7787@localhost|
|
||||
use test|
|
||||
|
||||
#
|
||||
# Bug#13575 SP funcs in select with distinct/group and order by can
|
||||
# produce bad data
|
||||
#
|
||||
create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb|
|
||||
insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')|
|
||||
CREATE FUNCTION bug13575 ( p1 integer )
|
||||
returns varchar(3)
|
||||
BEGIN
|
||||
DECLARE v1 VARCHAR(10) DEFAULT null;
|
||||
SELECT f2 INTO v1 FROM t3 WHERE f1 = p1;
|
||||
RETURN v1;
|
||||
END|
|
||||
select distinct f1, bug13575(f1) from t3 order by f1|
|
||||
drop function bug13575|
|
||||
drop table t3|
|
||||
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
|
@ -14,7 +14,6 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define USES_TYPES /* sys/types is included */
|
||||
#include "mysys_priv.h"
|
||||
#include <sys/stat.h>
|
||||
#include <m_string.h>
|
||||
|
@ -14,7 +14,6 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define USES_TYPES
|
||||
#include "my_global.h"
|
||||
|
||||
#if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__NETWARE__)
|
||||
|
@ -14,7 +14,6 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define USES_TYPES /* sys/types is included */
|
||||
#include "mysys_priv.h"
|
||||
#include <my_dir.h> /* for stat */
|
||||
#include <m_string.h>
|
||||
|
@ -14,7 +14,6 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define USES_TYPES
|
||||
#include "mysys_priv.h"
|
||||
#include <my_dir.h>
|
||||
#include "mysys_err.h"
|
||||
|
@ -14,7 +14,6 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define USES_TYPES
|
||||
#include "mysys_priv.h"
|
||||
#include "mysys_err.h"
|
||||
#include <my_dir.h>
|
||||
|
@ -17,7 +17,6 @@
|
||||
/* TODO: check for overun of memory for names. */
|
||||
/* Convert MSDOS-TIME to standar time_t (still needed?) */
|
||||
|
||||
#define USES_TYPES /* sys/types is included */
|
||||
#include "mysys_priv.h"
|
||||
#include <m_string.h>
|
||||
#include <my_dir.h> /* Structs used by my_dir,includes sys/types */
|
||||
|
@ -14,7 +14,6 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define USES_TYPES
|
||||
#include "mysys_priv.h"
|
||||
#include "mysys_err.h"
|
||||
#include <my_dir.h>
|
||||
|
@ -14,7 +14,6 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define USES_TYPES /* sys/types is included */
|
||||
#include "mysys_priv.h"
|
||||
#include <my_dir.h>
|
||||
#include <m_string.h>
|
||||
|
@ -14,7 +14,6 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define USES_TYPES
|
||||
#include "mysys_priv.h"
|
||||
#include <my_dir.h>
|
||||
#include "mysys_err.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
/* TODO: Test all functions */
|
||||
|
||||
#define USES_TYPES
|
||||
#include "mysys_priv.h"
|
||||
#include "my_dir.h"
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
str is a (long) to record position where 0 is the first position.
|
||||
*/
|
||||
|
||||
#define USES_TYPES
|
||||
#include "mysql_priv.h"
|
||||
#include <m_ctype.h>
|
||||
#include <assert.h>
|
||||
|
@ -92,7 +92,7 @@ int main(int argc, char** argv){
|
||||
wait_status= NDB_MGM_NODE_STATUS_STARTED;
|
||||
}
|
||||
|
||||
if (waitClusterStatus(_hostName, wait_status, _timeout) != 0)
|
||||
if (waitClusterStatus(_hostName, wait_status, _timeout*10) != 0)
|
||||
return NDBT_ProgramExit(NDBT_FAILED);
|
||||
return NDBT_ProgramExit(NDBT_OK);
|
||||
}
|
||||
@ -311,7 +311,7 @@ waitClusterStatus(const char* _addr,
|
||||
}
|
||||
g_info << "Waiting for cluster enter state "
|
||||
<< ndb_mgm_get_node_status_string(_status)<< endl;
|
||||
NdbSleep_SecSleep(1);
|
||||
NdbSleep_MilliSleep(100);
|
||||
attempts++;
|
||||
}
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user