Commit a751c743 authored by joerg@trift2's avatar joerg@trift2

Merge trift2.:/MySQL/M51/mysql-5.1

into  trift2.:/MySQL/M51/push-5.1
parents 48380a63 122f5f6c
......@@ -352,16 +352,11 @@ static my_bool get_full_path_to_executable(char* path)
/*
Look for the tool in the same directory as mysql_upgrade.
When running in a not yet installed build the the program
will exist but it need to be invoked via it's libtool wrapper.
Check if the found tool can executed and if not look in the
directory one step higher up where the libtool wrapper normally
is found
*/
static void find_tool(char *tool_path, const char *tool_name)
{
size_t path_len;
char path[FN_REFLEN];
DYNAMIC_STRING ds_tmp;
DBUG_ENTER("find_tool");
......@@ -395,38 +390,52 @@ static void find_tool(char *tool_path, const char *tool_name)
path[0]= 0;
}
}
do
{
size_t path_len;
DBUG_PRINT("enter", ("path: %s", path));
/* Chop off last char(since it might be a /) */
path[max((strlen(path)-1), 0)]= 0;
DBUG_PRINT("info", ("path: '%s'", path));
/* Chop off binary name (i.e mysql-upgrade) from path */
dirname_part(path, path, &path_len);
/*
When running in a not yet installed build and using libtool,
the program(mysql_upgrade) will be in .libs/ and executed
through a libtool wrapper in order to use the dynamic libraries
from this build. The same must be done for the tools(mysql and
mysqlcheck). Thus if path ends in .libs/, step up one directory
and execute the tools from there
*/
path[max(path_len-1, 0)]= 0; /* Chop off last / */
if (strncmp(path + dirname_length(path), ".libs", 5) == 0)
{
DBUG_PRINT("info", ("Chopping off .libs from '%s'", path));
/* Chop off last dir part */
/* Chop off .libs */
dirname_part(path, path, &path_len);
}
/* Format name of the tool to search for */
fn_format(tool_path, tool_name,
path, "", MYF(MY_REPLACE_DIR));
verbose("Looking for '%s' in: %s", tool_name, tool_path);
DBUG_PRINT("info", ("path: '%s'", path));
/* Make sure the tool exists */
if (my_access(tool_path, F_OK) != 0)
die("Can't find '%s'", tool_path);
/* Format name of the tool to search for */
fn_format(tool_path, tool_name,
path, "", MYF(MY_REPLACE_DIR));
/*
Make sure it can be executed, otherwise try again
in higher level directory
*/
}
while(run_tool(tool_path,
&ds_tmp, /* Get output from command, discard*/
"--help",
"2>&1",
IF_WIN("> NUL", "> /dev/null"),
NULL));
verbose("Looking for '%s' in: %s", tool_name, tool_path);
/* Make sure the tool exists */
if (my_access(tool_path, F_OK) != 0)
die("Can't find '%s'", tool_path);
/*
Make sure it can be executed
*/
if (run_tool(tool_path,
&ds_tmp, /* Get output from command, discard*/
"--help",
"2>&1",
IF_WIN("> NUL", "> /dev/null"),
NULL))
die("Can't execute '%s'", tool_path);
dynstr_free(&ds_tmp);
......@@ -457,6 +466,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
ret= run_tool(mysql_path,
ds_res,
"--no-defaults",
ds_args.str,
"--database=mysql",
"--batch", /* Turns off pager etc. */
......@@ -468,6 +478,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
NULL);
my_close(fd, MYF(0));
my_delete(query_file_path, MYF(0));
DBUG_RETURN(ret);
}
......@@ -618,6 +629,7 @@ static int run_mysqlcheck_upgrade(void)
verbose("Running 'mysqlcheck'...");
return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults",
ds_args.str,
"--check-upgrade",
"--all-databases",
......
This diff is collapsed.
......@@ -9,6 +9,7 @@
const char* SSLeay_version(int type);
#define SSLEAY_NUMBER_DEFINED
#define SSLEAY_VERSION 0x0900L
#define SSLEAY_VERSION_NUMBER SSLEAY_VERSION
......
/* des_old.h for openvn */
/* evp.h for openSSL */
#ifndef SSLEAY_NUMBER_DEFINED
#define SSLEAY_NUMBER_DEFINED
/* for OpenVPN */
#define SSLEAY_VERSION_NUMBER 0x0090700f
#endif /* SSLEAY_NUMBER_DEFINED */
/* hmac.h for openvpn */
/* objects.h for openvpn */
......@@ -30,6 +30,7 @@
#define SSL_CTX_new yaSSL_CTX_new
#define SSL_new yaSSL_new
#define SSL_set_fd yaSSL_set_fd
#define SSL_get_fd yaSSL_get_fd
#define SSL_connect yaSSL_connect
#define SSL_write yaSSL_write
#define SSL_read yaSSL_read
......@@ -91,6 +92,8 @@
#define SSL_set_rfd yaSSL_set_rfd
#define SSL_set_wfd yaSSL_set_wfd
#define SSL_set_shutdown yaSSL_set_shutdown
#define SSL_set_quiet_shutdown yaSSL_set_quiet_shutdown
#define SSL_get_quiet_shutdown yaSSL_get_quiet_shutdown
#define SSL_want_read yaSSL_want_read
#define SSL_want_write yaSSL_want_write
#define SSL_pending yaSSL_pending
......
......@@ -34,7 +34,7 @@
#include "rsa.h"
#define YASSL_VERSION "1.6.5"
#define YASSL_VERSION "1.7.2"
#if defined(__cplusplus)
......@@ -201,6 +201,7 @@ typedef int YASSL_SOCKET_T;
SSL_CTX* SSL_CTX_new(SSL_METHOD*);
SSL* SSL_new(SSL_CTX*);
int SSL_set_fd (SSL*, YASSL_SOCKET_T);
YASSL_SOCKET_T SSL_get_fd(const SSL*);
int SSL_connect(SSL*);
int SSL_write(SSL*, const void*, int);
int SSL_read(SSL*, void*, int);
......
......@@ -584,7 +584,7 @@ class SSL {
Socket socket_; // socket wrapper
Buffers buffers_; // buffered handshakes and data
Log log_; // logger
bool quietShutdown_; // shutdown without handshakes
bool quietShutdown_;
// optimization variables
bool has_data_; // buffered data ready?
......
......@@ -719,6 +719,10 @@ int DoProcessReply(SSL& ssl)
// add new data
uint read = ssl.useSocket().receive(buffer.get_buffer() + buffSz, ready);
if (read == static_cast<uint>(-1)) {
ssl.SetError(receive_error);
return 0;
}
buffer.add_size(read);
uint offset = 0;
const MessageFactory& mf = ssl.getFactory().getMessage();
......
......@@ -114,8 +114,6 @@ uint Socket::send(const byte* buf, unsigned int sz, int flags) const
const byte* pos = buf;
const byte* end = pos + sz;
assert(socket_ != INVALID_SOCKET);
while (pos != end) {
int sent = ::send(socket_, reinterpret_cast<const char *>(pos),
static_cast<int>(end - pos), flags);
......@@ -132,7 +130,6 @@ uint Socket::send(const byte* buf, unsigned int sz, int flags) const
uint Socket::receive(byte* buf, unsigned int sz, int flags)
{
assert(socket_ != INVALID_SOCKET);
wouldBlock_ = false;
int recvd = ::recv(socket_, reinterpret_cast<char *>(buf), sz, flags);
......@@ -163,7 +160,6 @@ bool Socket::wait()
void Socket::shutDown(int how)
{
assert(socket_ != INVALID_SOCKET);
shutdown(socket_, how);
}
......
......@@ -239,6 +239,12 @@ int SSL_set_fd(SSL* ssl, YASSL_SOCKET_T fd)
}
YASSL_SOCKET_T SSL_get_fd(const SSL* ssl)
{
return ssl->getSocket().get_fd();
}
int SSL_connect(SSL* ssl)
{
if (ssl->GetError() == YasslError(SSL_ERROR_WANT_READ))
......
......@@ -773,6 +773,7 @@ void SSL::SetError(YasslError ye)
// TODO: add string here
}
// set the quiet shutdown mode (close_nofiy not sent or received on shutdown)
void SSL::SetQuietShutdown(bool mode)
{
......
......@@ -107,11 +107,12 @@ void HexDecoder::Decode()
// sanity checks
assert( b < sizeof(hexDecode)/sizeof(hexDecode[0]) );
assert( b2 < sizeof(hexDecode)/sizeof(hexDecode[0]) );
assert( b != bad && b2 != bad );
b = hexDecode[b];
b2 = hexDecode[b2];
assert( b != bad && b2 != bad );
decoded_[i++] = (b << 4) | b2;
bytes -= 2;
}
......@@ -184,7 +185,7 @@ void Base64Decoder::Decode()
{
word32 bytes = coded_.size();
word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz);
plainSz = ((plainSz * 3) / 4) + 3;
plainSz = (plainSz * 3 + 3) / 4;
decoded_.New(plainSz);
word32 i = 0;
......
......@@ -26,6 +26,11 @@ extern "C" {
// locking handled internally by library
char CRYPTO_lock() { return 0;}
char CRYPTO_add_lock() { return 0;}
// for openvpn, test are the signatures they use
char EVP_CIPHER_CTX_init() { return 0; }
char CRYPTO_mem_ctrl() { return 0; }
} // extern "C"
......
......@@ -15,18 +15,17 @@
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA
# FIXME 'abi_check' should be in BUILT_SOURCES, disabled for now
BUILT_SOURCES = $(HEADERS_GEN) link_sources
HEADERS_GEN = mysql_version.h my_config.h
HEADERS_ABI = mysql.h mysql_com.h mysql_time.h \
my_list.h my_alloc.h typelib.h
my_list.h my_alloc.h typelib.h mysql/plugin.h
pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
my_xml.h mysql_embed.h \
my_pthread.h my_no_pthread.h \
decimal.h errmsg.h my_global.h my_net.h \
my_getopt.h sslopt-longopts.h my_dir.h \
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
m_ctype.h mysql/plugin.h my_attribute.h $(HEADERS_GEN)
m_ctype.h my_attribute.h $(HEADERS_GEN)
noinst_HEADERS = config-win.h config-netware.h \
heap.h my_bitmap.h my_uctype.h \
myisam.h myisampack.h myisammrg.h ft_global.h\
......@@ -72,9 +71,8 @@ dist-hook:
abi_check: $(HEADERS_ABI) mysql_version.h mysql_h.ic
@set -ex; \
if [ @ICHECK@ != no ] ; then \
@ICHECK@ --canonify --skip-from-re /usr/ -o $@.ic mysql.h; \
@ICHECK@ --compare mysql_h.ic $@.ic; \
$(RM) -f $@.ic; \
@ICHECK@ --canonify --skip-from-re /usr/ -o $@ $(HEADERS_ABI); \
@ICHECK@ --compare mysql_h.ic $@; \
fi; \
touch abi_check;
......
This diff is collapsed.
......@@ -564,6 +564,17 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag)
init_alloc_root(&mysql->field_alloc, 8192, 0);
}
/**
@brief Initialize a new THD for a connection in the embedded server
@param client_flag Client capabilities which this thread supports
@return pointer to the created THD object
@todo
This function copies code from several places in the server, including
create_new_thread(), and prepare_new_connection_state(). This should
be refactored to avoid code duplication.
*/
void *create_embedded_thd(int client_flag)
{
THD * thd= new THD;
......
#######################################
# Author: Rafal Somla #
# Date: 2006-08-20 #
# Purpose: Test replication of basic #
# table operations in various setups #
# #
# Based on rpl_ndb_2multi_eng.test by #
# JBM #
#######################################
--echo --- Doing pre test cleanup ---
connection master;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_query_log
#################################################
--echo --- Create Table Section ---
CREATE TABLE t1 (id MEDIUMINT NOT NULL,
b1 INT,
vc VARCHAR(255),
bc CHAR(255),
d DECIMAL(10,4) DEFAULT 0,
f FLOAT DEFAULT 0,
total BIGINT UNSIGNED,
y YEAR,
t DATE,
PRIMARY KEY(id));
--echo --- Show table on master ---
SHOW CREATE TABLE t1;
--echo --- Show table on slave ---
sync_slave_with_master;
SHOW CREATE TABLE t1;
--source include/rpl_multi_engine2.inc
#################################################
# Okay lets see how it holds up to table changes
--echo --- Check that simple Alter statements are replicated correctly --
ALTER TABLE t1 DROP PRIMARY KEY;
# note: table with no PK can't contain blobs if it is to be replicated.
ALTER TABLE t1 MODIFY vc char(32);
--echo --- Show the new improved table on the master ---
SHOW CREATE TABLE t1;
--echo --- Make sure that our tables on slave are still same engine ---
--echo --- and that the alter statements replicated correctly ---
sync_slave_with_master;
SHOW CREATE TABLE t1;
--source include/rpl_multi_engine2.inc
#################################################
--echo --- Check that replication works when slave has more columns than master
connection master;
ALTER TABLE t1 ADD PRIMARY KEY(id,total);
ALTER TABLE t1 MODIFY vc TEXT;
INSERT INTO t1 VALUES(3,1,'Testing MySQL databases is a cool ',
'Must make it bug free for the customer',
654321.4321,15.21,0,1965,"1905-11-14");
INSERT INTO t1 VALUES(20,1,'Testing MySQL databases is a cool ',
'Must make it bug free for the customer',
654321.4321,15.21,0,1965,"1965-11-14");
INSERT INTO t1 VALUES(50,1,'Testing MySQL databases is a cool ',
'Must make it bug free for the customer',
654321.4321,15.21,0,1965,"1985-11-14");
--echo --- Add columns on slave ---
--sync_slave_with_master
ALTER TABLE t1 ADD (u int, v char(16) default 'default');
UPDATE t1 SET u=7 WHERE id < 50;
UPDATE t1 SET v='explicit' WHERE id >10;
--echo --- Show changed table on slave ---
SHOW CREATE TABLE t1;
SELECT *
FROM t1
ORDER BY id;
--source include/rpl_multi_engine2.inc
TRUNCATE TABLE t1;
#################################################
--echo --- Check that replication works when master has more columns than slave
connection master;
--echo --- Remove columns on slave ---
--sync_slave_with_master
ALTER TABLE t1 DROP COLUMN v;
ALTER TABLE t1 DROP COLUMN u;
ALTER TABLE t1 DROP COLUMN t;
ALTER TABLE t1 DROP COLUMN y;
--echo --- Show changed table on slave ---
SHOW CREATE TABLE t1;
--source include/rpl_multi_engine2.inc
TRUNCATE TABLE t1;
#################################################
--echo --- Do Cleanup --
connection master;
DROP TABLE IF EXISTS t1;
sync_slave_with_master;
connection master;
......@@ -9,5 +9,6 @@ eval SHOW CREATE TABLE t1;
# listing of files belonging to the table t1
if ($ls)
{
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
}
#############################################################
# Author: Rafal
# Date: 2007-08-20
# based on rpl_multi_engine3.inc
#############################################################
connection slave;
STOP SLAVE;
RESET SLAVE;
connection master;
RESET MASTER;
connection slave;
START SLAVE;
--echo --- Populate t1 with data ---
connection master;
--disable_query_log
INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ',
'Must make it bug free for the customer',
654321.4321,15.21,0,1965,"1905-11-14");
INSERT INTO t1 VALUES(2,1,'Testing MySQL databases is a cool ',
'Must make it bug free for the customer',
654321.4321,15.21,0,1965,"1965-11-14");
INSERT INTO t1 VALUES(4,1,'Testing MySQL databases is a cool ',
'Must make it bug free for the customer',
654321.4321,15.21,0,1965,"1985-11-14");
INSERT INTO t1 VALUES(142,1,'Testing MySQL databases is a cool ',
'Must make it bug free for the customer',
654321.4321,15.21,0,1965,"1995-11-14");
INSERT INTO t1 VALUES(412,1,'Testing MySQL databases is a cool ',
'Must make it bug free for the customer',
654321.4321,15.21,0,1965,"2005-11-14");
--enable_query_log
--echo --- Select from t1 on master ---
select *
from t1
order by id;
sync_slave_with_master;
--echo --- Select from t1 on slave ---
select *
from t1
order by id;
--echo --- Perform basic operation on master ---
--echo --- and ensure replicated correctly ---
connection master;
--echo --- Update t1 on master --
UPDATE t1 SET b1 = 0, bc='updated', t="2006-02-22"
WHERE id < 100
ORDER BY id;
--echo --- Check the update on master ---
SELECT *
FROM t1
WHERE id < 100
ORDER BY id;
# Must give injector thread a little time to get update
# into the binlog other wise we will miss the update.
sync_slave_with_master;
--echo --- Check Update on slave ---
SELECT *
FROM t1
WHERE id < 100
ORDER BY id;
connection master;
--echo --- Remove a record from t1 on master ---
# Note: there is an error in replication of Delete_row
# from NDB to MyISAM (BUG#28538). However, if there is
# only one row in Delete_row event then it works fine,
# as this test demonstrates.
DELETE FROM t1 WHERE id = 412;
--echo --- Show current count on master for t1 ---
SELECT COUNT(*) FROM t1;
sync_slave_with_master;
--echo --- Show current count on slave for t1 ---
SELECT COUNT(*) FROM t1;
connection master;
TRUNCATE TABLE t1;
sync_slave_with_master;
connection master;
......@@ -53,7 +53,8 @@ sub collect_test_cases ($) {
my $found= 0;
foreach my $test ( @$cases )
{
if ( mtr_match_extension($test->{'name'}, $tname) )
if ( $test->{'name'} eq $tname ||
mtr_match_extension($test->{'name'}, $tname) )
{
$found= 1;
}
......@@ -192,8 +193,9 @@ sub collect_one_suite($$)
if ( @::opt_cases )
{
# Collect in specified order, no sort
foreach my $tname ( @::opt_cases )
foreach my $tname2 ( @::opt_cases )
{
my $tname= $tname2; # Don't modify @::opt_cases !
my $elem= undef;
my $component_id= undef;
......@@ -202,6 +204,9 @@ sub collect_one_suite($$)
$tname = basename($tname);
# Get rid of suite part
$tname =~ s/^$suite\.//;
# Check if the extenstion has been specified.
if ( mtr_match_extension($tname, "test") )
......
......@@ -19,9 +19,8 @@
# same name.
use strict;
use File::Find;
sub mtr_full_hostname ();
sub mtr_short_hostname ();
sub mtr_native_path($);
sub mtr_init_args ($);
sub mtr_add_arg ($$@);
......@@ -31,6 +30,7 @@ sub mtr_file_exists(@);
sub mtr_exe_exists(@);
sub mtr_exe_maybe_exists(@);
sub mtr_copy_dir($$);
sub mtr_rmtree($);
sub mtr_same_opts($$);
sub mtr_cmp_opts($$);
......@@ -40,30 +40,6 @@ sub mtr_cmp_opts($$);
#
##############################################################################
# We want the fully qualified host name and hostname() may have returned
# only the short name. So we use the resolver to find out.
# Note that this might fail on some platforms
sub mtr_full_hostname () {
my $hostname= hostname();
if ( $hostname !~ /\./ )
{
my $address= gethostbyname($hostname)
or mtr_error("Couldn't resolve $hostname : $!");
my $fullname= gethostbyaddr($address, AF_INET);
$hostname= $fullname if $fullname;
}
return $hostname;
}
sub mtr_short_hostname () {
my $hostname= hostname();
$hostname =~ s/\..+$//;
return $hostname;
}
# Convert path to OS native format
sub mtr_native_path($)
{
......@@ -226,6 +202,57 @@ sub mtr_copy_dir($$) {
}
sub mtr_rmtree($) {
my ($dir)= @_;
mtr_verbose("mtr_rmtree: $dir");
# Try to use File::Path::rmtree. Recent versions
# handles removal of directories and files that don't
# have full permissions, while older versions
# may have a problem with that and we use our own version
eval { rmtree($dir); };
if ( $@ ) {
mtr_warning("rmtree($dir) failed, trying with File::Find...");
my $errors= 0;
# chmod
find( {
no_chdir => 1,
wanted => sub {
chmod(0777, $_)
or mtr_warning("couldn't chmod(0777, $_): $!") and $errors++;
}
},
$dir
);
# rm
finddepth( {
no_chdir => 1,
wanted => sub {
my $file= $_;
# Use special underscore (_) filehandle, caches stat info
if (!-l $file and -d _ ) {
rmdir($file) or
mtr_warning("couldn't rmdir($file): $!") and $errors++;
} else {
unlink($file)
or mtr_warning("couldn't unlink($file): $!") and $errors++;
}
}
},
$dir
);
mtr_error("Failed to remove '$dir'") if $errors;
mtr_report("OK, that worked!");
}
}
sub mtr_same_opts ($$) {
my $l1= shift;
my $l2= shift;
......
......@@ -99,25 +99,26 @@ sub spawn_impl ($$$$$$$) {
if ( $::opt_script_debug )
{
print STDERR "\n";
print STDERR "#### ", "-" x 78, "\n";
print STDERR "#### ", "STDIN $input\n" if $input;
print STDERR "#### ", "STDOUT $output\n" if $output;
print STDERR "#### ", "STDERR $error\n" if $error;
print STDERR "#### ", "$mode : $path ", join(" ",@$arg_list_t), "\n";
print STDERR "#### ", "spawn options:\n";
mtr_report("");
mtr_debug("-" x 73);
mtr_debug("STDIN $input") if $input;
mtr_debug("STDOUT $output") if $output;
mtr_debug("STDERR $error") if $error;
mtr_debug("$mode: $path ", join(" ",@$arg_list_t));
mtr_debug("spawn options:");
if ($spawn_opts)
{
foreach my $key (sort keys %{$spawn_opts})
{
print STDERR "#### ", " - $key: $spawn_opts->{$key}\n";
mtr_debug(" - $key: $spawn_opts->{$key}");
}
}
else
{
print STDERR "#### ", " none\n";
mtr_debug(" none");
}
print STDERR "#### ", "-" x 78, "\n";
mtr_debug("-" x 73);
mtr_report("");
}
mtr_error("Can't spawn with empty \"path\"") unless defined $path;
......
......@@ -19,6 +19,7 @@
# same name.
use strict;
use warnings;
sub mtr_report_test_name($);
sub mtr_report_test_passed($);
......@@ -26,7 +27,6 @@ sub mtr_report_test_failed($);
sub mtr_report_test_skipped($);
sub mtr_report_test_not_skipped_though_disabled($);
sub mtr_show_failed_diff ($);
sub mtr_report_stats ($);
sub mtr_print_line ();
sub mtr_print_thick_line ();
......@@ -38,6 +38,9 @@ sub mtr_child_error (@);
sub mtr_debug (@);
sub mtr_verbose (@);
my $tot_real_time= 0;
##############################################################################
#
......@@ -45,43 +48,10 @@ sub mtr_verbose (@);
#
##############################################################################
# We can't use diff -u or diff -a as these are not portable
sub mtr_show_failed_diff ($) {
my $tinfo= shift;
# The reject and log files have been dumped to
# to filenames based on the result_file's name
my $base_file= mtr_match_extension($tinfo->{'result_file'},
"result"); # Trim extension
my $reject_file= "$base_file.reject";
my $result_file= "$base_file.result";
my $log_file= "$base_file.log";
my $diffopts= $::opt_udiff ? "-u" : "-c";
if ( -f $reject_file )
{
print "Below are the diffs between actual and expected results:\n";
print "-------------------------------------------------------\n";
# FIXME check result code?!
mtr_run("diff",[$diffopts,$result_file,$reject_file], "", "", "", "");
print "-------------------------------------------------------\n";
print "Please follow the instructions outlined at\n";
print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n";
print "to find the reason to this problem and how to report this.\n\n";
}
if ( -f $log_file )
{
print "Result from queries before failure can be found in $log_file\n";
# FIXME Maybe a tail -f -n 10 $log_file here
}
}
sub mtr_report_test_name ($) {
my $tinfo= shift;
_mtr_log("$tinfo->{name}");
printf "%-30s ", $tinfo->{'name'};
}
......@@ -91,15 +61,15 @@ sub mtr_report_test_skipped ($) {
$tinfo->{'result'}= 'MTR_RES_SKIPPED';
if ( $tinfo->{'disable'} )
{
print "[ disabled ] $tinfo->{'comment'}\n";
mtr_report("[ disabled ] $tinfo->{'comment'}");
}
elsif ( $tinfo->{'comment'} )
{
print "[ skipped ] $tinfo->{'comment'}\n";
mtr_report("[ skipped ] $tinfo->{'comment'}");
}
else
{
print "[ skipped ]\n";
mtr_report("[ skipped ]");
}
}
......@@ -127,11 +97,11 @@ sub mtr_report_test_passed ($) {
if ( $::opt_timer and -f "$::opt_vardir/log/timer" )
{
$timer= mtr_fromfile("$::opt_vardir/log/timer");
$::glob_tot_real_time += ($timer/1000);
$tot_real_time += ($timer/1000);
$timer= sprintf "%12s", $timer;
}
$tinfo->{'result'}= 'MTR_RES_PASSED';
print "[ pass ] $timer\n";
mtr_report("[ pass ] $timer");
}
sub mtr_report_test_failed ($) {
......@@ -140,27 +110,34 @@ sub mtr_report_test_failed ($) {
$tinfo->{'result'}= 'MTR_RES_FAILED';
if ( defined $tinfo->{'timeout'} )
{
print "[ fail ] timeout\n";
mtr_report("[ fail ] timeout");
return;
}
else
{
print "[ fail ]\n";
mtr_report("[ fail ]");
}
if ( $tinfo->{'comment'} )
{
print "\nERROR: $tinfo->{'comment'}\n";
# The test failure has been detected by mysql-test-run.pl
# when starting the servers or due to other error, the reason for
# failing the test is saved in "comment"
mtr_report("\nERROR: $tinfo->{'comment'}");
}
elsif ( -f $::path_timefile )
{
print "\nErrors are (from $::path_timefile) :\n";
# Test failure was detected by test tool and it's report
# about what failed has been saved to file. Display the report.
print "\n";
print mtr_fromfile($::path_timefile); # FIXME print_file() instead
print "\n(the last lines may be the most important ones)\n";
print "\n";
}
else
{
print "\nUnexpected termination, probably when starting mysqld\n";
# Neither this script or the test tool has recorded info
# about why the test has failed. Should be debugged.
mtr_report("\nUnexpected termination, probably when starting mysqld");;
}
}
......@@ -228,8 +205,10 @@ sub mtr_report_stats ($) {
if ( $::opt_timer )
{
print
"Spent $::glob_tot_real_time seconds actually executing testcases\n"
use English;
mtr_report("Spent", sprintf("%.3f", $tot_real_time),"of",
time - $BASETIME, "seconds executing testcases");
}
# ----------------------------------------------------------------------
......@@ -484,35 +463,66 @@ sub mtr_print_header () {
##############################################################################
#
# Misc
# Log and reporting functions
#
##############################################################################
use IO::File;
my $log_file_ref= undef;
sub mtr_log_init ($) {
my ($filename)= @_;
mtr_error("Log is already open") if defined $log_file_ref;
$log_file_ref= IO::File->new($filename, "a") or
mtr_warning("Could not create logfile $filename: $!");
}
sub _mtr_log (@) {
print $log_file_ref join(" ", @_),"\n"
if defined $log_file_ref;
}
sub mtr_report (@) {
# Print message to screen and log
_mtr_log(@_);
print join(" ", @_),"\n";
}
sub mtr_warning (@) {
# Print message to screen and log
_mtr_log("WARNING: ", @_);
print STDERR "mysql-test-run: WARNING: ",join(" ", @_),"\n";
}
sub mtr_error (@) {
# Print message to screen and log
_mtr_log("ERROR: ", @_);
print STDERR "mysql-test-run: *** ERROR: ",join(" ", @_),"\n";
mtr_exit(1);
}
sub mtr_child_error (@) {
# Print message to screen and log
_mtr_log("ERROR(child): ", @_);
print STDERR "mysql-test-run: *** ERROR(child): ",join(" ", @_),"\n";
exit(1);
}
sub mtr_debug (@) {
# Only print if --script-debug is used
if ( $::opt_script_debug )
{
_mtr_log("###: ", @_);
print STDERR "####: ",join(" ", @_),"\n";
}
}
sub mtr_verbose (@) {
# Always print to log, print to screen only when --verbose is used
_mtr_log("> ",@_);
if ( $::opt_verbose )
{
print STDERR "> ",join(" ", @_),"\n";
......
......@@ -18,7 +18,6 @@
# and is part of the translation of the Bourne shell script with the
# same name.
use Socket;
use Errno;
use strict;
......@@ -52,12 +51,10 @@ sub mtr_init_timers () {
sub mtr_timer_start($$$) {
my ($timers,$name,$duration)= @_;
mtr_verbose("mtr_timer_start: $name, $duration");
if ( exists $timers->{'timers'}->{$name} )
{
# We have an old running timer, kill it
mtr_verbose("There is an old timer running");
mtr_warning("There is an old timer running");
mtr_timer_stop($timers,$name);
}
......@@ -75,22 +72,22 @@ sub mtr_timer_start($$$) {
}
else
{
mtr_error("can't fork");
mtr_error("can't fork timer, error: $!");
}
}
if ( $tpid )
{
# Parent, record the information
mtr_verbose("timer parent, record info($name, $tpid, $duration)");
mtr_verbose("Starting timer for '$name',",
"duration: $duration, pid: $tpid");
$timers->{'timers'}->{$name}->{'pid'}= $tpid;
$timers->{'timers'}->{$name}->{'duration'}= $duration;
$timers->{'pids'}->{$tpid}= $name;
}
else
{
# Child, redirect output and exec
# FIXME do we need to redirect streams?
# Child, install signal handlers and sleep for "duration"
# Don't do the ^C cleanup in the timeout child processes!
# There is actually a race here, if we get ^C after fork(), but before
......@@ -98,13 +95,13 @@ sub mtr_timer_start($$$) {
$SIG{INT}= 'DEFAULT';
$SIG{TERM}= sub {
mtr_verbose("timer woke up, exiting!");
mtr_verbose("timer $$ woke up, exiting!");
exit(0);
};
$0= "mtr_timer(timers,$name,$duration)";
sleep($duration);
mtr_verbose("timer expired after $duration seconds");
mtr_verbose("timer $$ expired after $duration seconds");
exit(0);
}
}
......@@ -114,12 +111,10 @@ sub mtr_timer_start($$$) {
sub mtr_timer_stop ($$) {
my ($timers,$name)= @_;
mtr_verbose("mtr_timer_stop: $name");
if ( exists $timers->{'timers'}->{$name} )
{
my $tpid= $timers->{'timers'}->{$name}->{'pid'};
mtr_verbose("Stopping timer with pid $tpid");
mtr_verbose("Stopping timer for '$name' with pid $tpid");
# FIXME as Cygwin reuses pids fast, maybe check that is
# the expected process somehow?!
......@@ -134,11 +129,8 @@ sub mtr_timer_stop ($$) {
return 1;
}
else
{
mtr_error("Asked to stop timer \"$name\" not started");
return 0;
}
mtr_error("Asked to stop timer '$name' not started");
}
......@@ -158,7 +150,8 @@ sub mtr_timer_timeout ($$) {
return "" unless exists $timers->{'pids'}->{$pid};
# We got a timeout, return the name ot the timer
# Got a timeout(the process with $pid is recorded as being a timer)
# return the name of the timer
return $timers->{'pids'}->{$pid};
}
......
......@@ -61,7 +61,6 @@ use File::Copy;
use File::Temp qw /tempdir/;
use Cwd;
use Getopt::Long;
use Sys::Hostname;
use IO::Socket;
use IO::Socket::INET;
use strict;
......@@ -83,7 +82,6 @@ require "lib/mtr_io.pl";
require "lib/mtr_gcov.pl";
require "lib/mtr_gprof.pl";
require "lib/mtr_report.pl";
require "lib/mtr_diff.pl";
require "lib/mtr_match.pl";
require "lib/mtr_misc.pl";
require "lib/mtr_stress.pl";
......@@ -101,7 +99,6 @@ $Devel::Trace::TRACE= 1;
our $mysql_version_id;
our $glob_mysql_test_dir= undef;
our $glob_mysql_bench_dir= undef;
our $glob_hostname= undef;
our $glob_scriptname= undef;
our $glob_timers= undef;
our $glob_use_embedded_server= 0;
......@@ -234,7 +231,6 @@ my $opt_report_features;
our $opt_check_testcases;
our $opt_mark_progress;
our $opt_skip;
our $opt_skip_rpl;
our $max_slave_num= 0;
our $max_master_num= 1;
......@@ -277,13 +273,8 @@ our $opt_stress_test_duration= 0;
our $opt_stress_init_file= "";
our $opt_stress_test_file= "";
our $opt_wait_for_master;
our $opt_wait_for_slave;
our $opt_warnings;
our $opt_udiff;
our $opt_skip_ndbcluster= 0;
our $opt_skip_ndbcluster_slave= 0;
our $opt_with_ndbcluster= 0;
......@@ -307,7 +298,6 @@ our @data_dir_lst;
our $used_binlog_format;
our $used_default_engine;
our $debug_compiled_binaries;
our $glob_tot_real_time= 0;
our %mysqld_variables;
......@@ -619,7 +609,6 @@ sub command_line_setup () {
'start-dirty' => \$opt_start_dirty,
'start-and-exit' => \$opt_start_and_exit,
'timer!' => \$opt_timer,
'unified-diff|udiff' => \$opt_udiff,
'user=s' => \$opt_user,
'testcase-timeout=i' => \$opt_testcase_timeout,
'suite-timeout=i' => \$opt_suite_timeout,
......@@ -655,8 +644,6 @@ sub command_line_setup () {
$source_dist= 1;
}
$glob_hostname= mtr_short_hostname();
# Find the absolute path to the test directory
$glob_mysql_test_dir= cwd();
if ( $glob_cygwin_perl )
......@@ -2209,7 +2196,7 @@ sub remove_stale_vardir () {
{
# Remove the directory which the link points at
mtr_verbose("Removing " . readlink($opt_vardir));
rmtree(readlink($opt_vardir));
mtr_rmtree(readlink($opt_vardir));
# Remove the "var" symlink
mtr_verbose("unlink($opt_vardir)");
......@@ -2237,7 +2224,7 @@ sub remove_stale_vardir () {
foreach my $bin ( glob("$opt_vardir/*") )
{
mtr_verbose("Removing bin $bin");
rmtree($bin);
mtr_rmtree($bin);
}
}
}
......@@ -2245,7 +2232,7 @@ sub remove_stale_vardir () {
{
# Remove the entire "var" dir
mtr_verbose("Removing $opt_vardir/");
rmtree("$opt_vardir/");
mtr_rmtree("$opt_vardir/");
}
if ( $opt_mem )
......@@ -2254,7 +2241,7 @@ sub remove_stale_vardir () {
# remove the $opt_mem dir to assure the symlink
# won't point at an old directory
mtr_verbose("Removing $opt_mem");
rmtree($opt_mem);
mtr_rmtree($opt_mem);
}
}
......@@ -2267,11 +2254,11 @@ sub remove_stale_vardir () {
# Remove the var/ dir in mysql-test dir if any
# this could be an old symlink that shouldn't be there
mtr_verbose("Removing $default_vardir");
rmtree($default_vardir);
mtr_rmtree($default_vardir);
# Remove the "var" dir
mtr_verbose("Removing $opt_vardir/");
rmtree("$opt_vardir/");
mtr_rmtree("$opt_vardir/");
}
}
......@@ -2924,13 +2911,16 @@ sub initialize_servers () {
}
}
check_running_as_root();
mtr_log_init("$opt_vardir/log/mysql-test-run.log");
}
sub mysql_install_db () {
install_db('master', $master->[0]->{'path_myddir'});
if ($max_master_num)
if ($max_master_num > 1)
{
copy_install_db('master', $master->[1]->{'path_myddir'});
}
......@@ -3092,11 +3082,15 @@ sub install_db ($$) {
mtr_appendfile_to_file("$path_sql_dir/fill_help_tables.sql",
$bootstrap_sql_file);
mtr_tofile($bootstrap_sql_file,
"DELETE FROM mysql.user where user= '';");
# Log bootstrap command
my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log";
mtr_tofile($path_bootstrap_log,
"$exe_mysqld_bootstrap " . join(" ", @$args) . "\n");
if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file,
$path_bootstrap_log, $path_bootstrap_log,
"", { append_log_file => 1 }) != 0 )
......@@ -3221,7 +3215,7 @@ sub restore_slave_databases ($) {
{
my $data_dir= $slave->[$idx]->{'path_myddir'};
my $name= basename($data_dir);
rmtree($data_dir);
mtr_rmtree($data_dir);
mtr_copy_dir("$path_snapshot/$name", $data_dir);
}
}
......@@ -3394,56 +3388,6 @@ sub find_testcase_skipped_reason($)
}
sub analyze_testcase_failure_sync_with_master($)
{
my ($tinfo)= @_;
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--silent");
mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
mtr_add_arg($args, "--port=%d", $master->[0]->{'port'});
mtr_add_arg($args, "--database=test");
mtr_add_arg($args, "--user=%s", $opt_user);
mtr_add_arg($args, "--password=");
# Run the test file and append output to log file
mtr_run_test($exe_mysqltest,$args,
"include/analyze_failure_sync_with_master.test",
"$path_timefile", "$path_timefile","",
{ append_log_file => 1 });
}
sub analyze_testcase_failure($)
{
my ($tinfo)= @_;
# Open mysqltest.log
my $F= IO::File->new($path_timefile)
or return;
while ( my $line= <$F> )
{
# Look for "mysqltest: At line nnn: <error>
if ( $line =~ /mysqltest: At line [0-9]*: (.*)/ )
{
my $error= $1;
# Look for "could not sync with master"
if ( $error =~ /could not sync with master/ )
{
analyze_testcase_failure_sync_with_master($tinfo);
}
}
}
}
##############################################################################
#
# Run a single test case
......@@ -3543,10 +3487,6 @@ sub run_testcase ($) {
}
elsif ( $res == 1 )
{
if ( $opt_force )
{
analyze_testcase_failure($tinfo);
}
# Test case failure reported by mysqltest
report_failure_and_restart($tinfo);
}
......@@ -3580,7 +3520,7 @@ sub run_testcase ($) {
sub save_installed_db () {
mtr_report("Saving snapshot of installed databases");
rmtree($path_snapshot);
mtr_rmtree($path_snapshot);
foreach my $data_dir (@data_dir_lst)
{
......@@ -3627,7 +3567,7 @@ sub restore_installed_db ($) {
{
my $name= basename($data_dir);
save_files_before_restore($test_name, $data_dir);
rmtree("$data_dir");
mtr_rmtree("$data_dir");
mtr_copy_dir("$path_snapshot/$name", "$data_dir");
}
......@@ -3637,7 +3577,7 @@ sub restore_installed_db ($) {
{
foreach my $ndbd (@{$cluster->{'ndbds'}})
{
rmtree("$ndbd->{'path_fs'}" );
mtr_rmtree("$ndbd->{'path_fs'}" );
}
}
}
......@@ -3652,7 +3592,6 @@ sub report_failure_and_restart ($) {
my $tinfo= shift;
mtr_report_test_failed($tinfo);
mtr_show_failed_diff($tinfo);
print "\n";
if ( $opt_force )
{
......@@ -3661,13 +3600,13 @@ sub report_failure_and_restart ($) {
# Restore the snapshot of the installed test db
restore_installed_db($tinfo->{'name'});
print "Resuming Tests\n\n";
mtr_report("Resuming Tests\n");
return;
}
my $test_mode= join(" ", @::glob_test_mode) || "default";
print "Aborting: $tinfo->{'name'} failed in $test_mode mode. ";
print "To continue, re-run with '--force'.\n";
mtr_report("Aborting: $tinfo->{'name'} failed in $test_mode mode. ");
mtr_report("To continue, re-run with '--force'.");
if ( ! $glob_debugger and
! $opt_extern and
! $glob_use_embedded_server )
......@@ -4093,6 +4032,9 @@ sub mysqld_start ($$$) {
$wait_for_pid_file= 0;
}
# Remove the pidfile
unlink($mysqld->{'path_pid'});
if ( defined $exe )
{
$pid= mtr_spawn($exe, $args, "",
......@@ -4126,11 +4068,11 @@ sub mysqld_start ($$$) {
sub stop_all_servers () {
print "Stopping All Servers\n";
mtr_report("Stopping All Servers");
if ( ! $opt_skip_im )
{
print "Shutting-down Instance Manager\n";
mtr_report("Shutting-down Instance Manager");
unless (mtr_im_stop($instance_manager, "stop_all_servers"))
{
mtr_error("Failed to stop Instance Manager.")
......@@ -4840,6 +4782,9 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--test-file=%s", $tinfo->{'path'});
# Number of lines of resut to include in failure report
mtr_add_arg($args, "--tail-lines=20");
if ( defined $tinfo->{'result_file'} ) {
mtr_add_arg($args, "--result-file=%s", $tinfo->{'result_file'});
}
......@@ -5253,7 +5198,6 @@ Misc options
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
testcase-timeout=MINUTES Max test case run time (default $default_testcase_timeout)
suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout)
......
......@@ -80,7 +80,7 @@ select STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T');
STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T')
NULL
Warnings:
Error 1411 Incorrect time value: '22.30.61' for function str_to_time
Error 1411 Incorrect time value: '22.30.61' for function str_to_date
create table t1 (date char(30), format char(30) not null);
insert into t1 values
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
......@@ -352,21 +352,21 @@ Tuesday 52 2001 %W %u %x NULL
7 53 1998 %w %u %Y NULL
NULL %m.%d.%Y NULL
Warnings:
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_time
Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_time
Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_time
Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_time
Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_time
Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date
Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date
Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date
Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_date
select date,format,concat(str_to_date(date, format),'') as con from t1;
date format con
2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL
......@@ -386,21 +386,21 @@ Tuesday 52 2001 %W %u %x NULL
7 53 1998 %w %u %Y NULL
NULL %m.%d.%Y NULL
Warnings:
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_time
Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_time
Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_time
Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_time
Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_time
Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date
Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date
Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date
Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_date
truncate table t1;
insert into t1 values
('10:20:10AM', '%h:%i:%s'),
......@@ -440,7 +440,7 @@ select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'));
str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'))
NULL
Warnings:
Error 1411 Incorrect datetime value: '15-01-2001 12:59:59' for function str_to_time
Error 1411 Incorrect datetime value: '15-01-2001 12:59:59' for function str_to_date
explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
......
......@@ -191,3 +191,7 @@ drop table table_26093;
drop function func_26093_a;
drop function func_26093_b;
End of 5.0 tests
select connection_id() > 0;
connection_id() > 0
1
End of tests
......@@ -501,7 +501,7 @@ ERROR 23000: Duplicate entry 'test2' for key 'ggid'
select * from t1;
id ggid email passwd
1 this will work
3 test2 this will work
4 test2 this will work
select * from t1 where id=1;
id ggid email passwd
1 this will work
......
......@@ -3,7 +3,9 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.general_log
Error : You can't use locks with log tables.
status : OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
......@@ -14,7 +16,9 @@ mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.slow_log
Error : You can't use locks with log tables.
status : OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......@@ -29,7 +33,9 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.general_log
Error : You can't use locks with log tables.
status : OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
......@@ -40,7 +46,9 @@ mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.slow_log
Error : You can't use locks with log tables.
status : OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......@@ -55,7 +63,9 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.general_log
Error : You can't use locks with log tables.
status : OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
......@@ -66,7 +76,9 @@ mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.slow_log
Error : You can't use locks with log tables.
status : OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......@@ -83,7 +95,9 @@ mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.general_log
Error : You can't use locks with log tables.
status : OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
......@@ -94,7 +108,9 @@ mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.slow_log
Error : You can't use locks with log tables.
status : OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......
......@@ -280,8 +280,20 @@ let $B = changed value of B;
var2: content of variable 1
var3: content of variable 1 content of variable 1
length of var3 is longer than 0
var1
hi 1 hi there
var2
2
var2 again
2
var3 two columns with same name
1 2 3
var4 from query that returns NULL
var5 from query that returns no row
failing query in let
mysqltest: At line 1: Error running query 'failing query': 1064 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 'failing query' at line 1
mysqltest: At line 1: Missing required argument 'filename' to command 'source'
mysqltest: At line 1: Could not open file ./non_existingFile
mysqltest: At line 1: Could not open file './non_existingFile'
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: 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 'garbage' at line 1
......@@ -340,6 +352,8 @@ here is the sourced script
In loop
here is the sourced script
here is the sourced script
"hello"
"hello"
mysqltest: At line 1: Missing argument to sleep
mysqltest: At line 1: Missing argument to real_sleep
mysqltest: At line 1: Invalid argument to sleep "abc"
......@@ -461,7 +475,6 @@ root@localhost
--------------------------------------------------------------------------------
this will be executed
this will be executed
mysqltest: Result length mismatch
mysqltest: The test didn't produce any output
Failing multi statement query
mysqltest: At line 3: query 'create table t1 (a int primary key);
......@@ -473,6 +486,8 @@ mysqltest: At line 3: query 'create table t1 (a int primary key);
insert into t1 values (1);
select 'select-me';
insertz 'error query'' failed: 1064: 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 'insertz 'error query'' at line 1
More results from queries before failure can be found in MYSQLTEST_VARDIR/log/bug11731.log
drop table t1;
Multi statement using expected error
create table t1 (a int primary key);
......@@ -520,17 +535,19 @@ drop table t1;
mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file'
mysqltest: At line 1: Missing required argument 'filename' to command 'write_file'
mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found
Content for test_file1
mysqltest: At line 1: File already exist: 'MYSQLTEST_VARDIR/tmp/test_file1.tmp'
Some data
for cat_file command
of mysqltest
mysqltest: At line 1: Failed to open file non_existing_file
mysqltest: At line 1: Failed to open file 'non_existing_file'
mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'mode' to command 'chmod'
mysqltest: At line 1: You must write a 4 digit octal number for mode
mysqltest: At line 1: You must write a 4 digit octal number for mode
mysqltest: At line 1: Missing required argument 'file' to command 'chmod'
mysqltest: At line 1: Missing required argument 'filename' to command 'chmod'
mysqltest: At line 1: You must write a 4 digit octal number for mode
mysqltest: At line 1: You must write a 4 digit octal number for mode
hello
......
......@@ -215,11 +215,11 @@ ERROR 22007: Incorrect date value: '2004-10-00 15:30:00' for column 'col1' at ro
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '2004-09-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '2003-02-29 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_time
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
......@@ -230,11 +230,11 @@ ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' a
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_time
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col2' at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
......@@ -246,11 +246,11 @@ ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' a
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_time
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col3' at row 1
drop table t1;
......@@ -1070,24 +1070,24 @@ create table t1 (col1 datetime);
insert into t1 values(STR_TO_DATE('31.10.2004 15.30 abc','%d.%m.%Y %H.%i'));
ERROR 22007: Truncated incorrect datetime value: '31.10.2004 15.30 abc'
insert into t1 values(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
insert into t1 values(STR_TO_DATE('2004.12.12 22:22:33 AM','%Y.%m.%d %r'));
ERROR HY000: Incorrect time value: '22:22:33 AM' for function str_to_time
ERROR HY000: Incorrect time value: '22:22:33 AM' for function str_to_date
insert into t1 values(STR_TO_DATE('2004.12.12 abc','%Y.%m.%d %T'));
ERROR HY000: Incorrect time value: 'abc' for function str_to_time
ERROR HY000: Incorrect time value: 'abc' for function str_to_date
set sql_mode='';
insert into t1 values(STR_TO_DATE('31.10.2004 15.30 abc','%d.%m.%Y %H.%i'));
Warnings:
Warning 1292 Truncated incorrect datetime value: '31.10.2004 15.30 abc'
insert into t1 values(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
Warnings:
Error 1411 Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
Error 1411 Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
insert into t1 values(STR_TO_DATE('2004.12.12 22:22:33 AM','%Y.%m.%d %r'));
Warnings:
Error 1411 Incorrect time value: '22:22:33 AM' for function str_to_time
Error 1411 Incorrect time value: '22:22:33 AM' for function str_to_date
insert into t1 values(STR_TO_DATE('2004.12.12 abc','%Y.%m.%d %T'));
Warnings:
Error 1411 Incorrect time value: 'abc' for function str_to_time
Error 1411 Incorrect time value: 'abc' for function str_to_date
insert into t1 values(STR_TO_DATE('31.10.2004 15.30','%d.%m.%Y %H.%i'));
insert into t1 values(STR_TO_DATE('2004.12.12 11:22:33 AM','%Y.%m.%d %r'));
insert into t1 values(STR_TO_DATE('2004.12.12 10:22:59','%Y.%m.%d %T'));
......@@ -1105,9 +1105,9 @@ select count(*) from t1 where STR_TO_DATE('2004.12.12 10:22:61','%Y.%m.%d %T') I
count(*)
7
Warnings:
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_time
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_time
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_time
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
drop table t1;
create table t1 (col1 char(3), col2 integer);
insert into t1 (col1) values (cast(1000 as char(3)));
......
##############################################################################
#
# List the test cases that are to be disabled temporarily.
#
# Separate the test case name and the comment with ':'.
#
# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
#
# Do not use any TAB characters for whitespace.
#
##############################################################################
im_options : Bug#20294 2006-07-24 stewart Instance manager test im_options fails randomly
im_daemon_life_cycle : Bug#20294 2007-05-14 alik Instance manager tests fail randomly
im_cmd_line : Bug#20294 2007-05-14 alik Instance manager tests fail randomly
im_utils : Bug#20294 2007-05-30 alik Instance manager tests fail randomly
im_instance_conf : Bug#20294 2007-05-30 alik Instance manager tests fail randomly
im_life_cycle : BUG#27851 Instance manager dies on ASSERT in ~Thread_registry() or from not being able to close a mysqld instance.
im_instance_conf : BUG#28743 Instance manager generates warnings in test suite
im_utils : BUG#28743 Instance manager generates warnings in test suite
......@@ -4,7 +4,7 @@
#
###########################################################################
--source include/im_check_env.inc
--source suite/im/t/im_check_env.inc
###########################################################################
......
let $UTIL=$MYSQL_TEST_DIR/suite/im/t;
###########################################################################
#
# This file contains test for (1.2) test suite.
......@@ -6,11 +8,11 @@
#
###########################################################################
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle im_daemon_life_cycle.imtest started.
--exec $UTIL/log.sh im_daemon_life_cycle im_daemon_life_cycle.imtest started.
###########################################################################
--source include/im_check_env.inc
--source suite/im/t/im_check_env.inc
# Turn on reconnect, not on by default anymore.
--enable_reconnect
......@@ -30,15 +32,15 @@
#
###########################################################################
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Main-test: starting...
--exec $UTIL/log.sh im_daemon_life_cycle Main-test: starting...
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Killing IM-main...
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 55 im_daemon_life_cycle
--exec $UTIL/log.sh im_daemon_life_cycle Killing IM-main...
--exec $UTIL/kill_n_check.sh $IM_PATH_PID restarted 55 im_daemon_life_cycle
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Waiting for IM-main to start accepting connections...
--exec $MYSQL_TEST_DIR/t/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 55 im_daemon_life_cycle
--exec $UTIL/log.sh im_daemon_life_cycle Waiting for IM-main to start accepting connections...
--exec $UTIL/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 55 im_daemon_life_cycle
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Main-test: done.
--exec $UTIL/log.sh im_daemon_life_cycle Main-test: done.
###########################################################################
#
......@@ -55,29 +57,29 @@
--echo -- Test for BUG#12751
--echo --------------------------------------------------------------------
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle BUG12751: starting...
--exec $UTIL/log.sh im_daemon_life_cycle BUG12751: starting...
# 1. Start mysqld;
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: starting...
--exec $UTIL/log.sh im_daemon_life_cycle mysqld2: starting...
START INSTANCE mysqld2;
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: waiting to start...
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 55 started im_daemon_life_cycle
--exec $UTIL/log.sh im_daemon_life_cycle mysqld2: waiting to start...
--exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 55 started im_daemon_life_cycle
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: started.
--exec $UTIL/log.sh im_daemon_life_cycle mysqld2: started.
# 2. Restart IM-main;
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Killing IM-main...
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 55 im_daemon_life_cycle
--exec $UTIL/log.sh im_daemon_life_cycle Killing IM-main...
--exec $UTIL/kill_n_check.sh $IM_PATH_PID restarted 55 im_daemon_life_cycle
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Waiting for IM-main to start accepting connections...
--exec $MYSQL_TEST_DIR/t/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 55 im_daemon_life_cycle
--exec $UTIL/log.sh im_daemon_life_cycle Waiting for IM-main to start accepting connections...
--exec $UTIL/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 55 im_daemon_life_cycle
# 3. Issue some statement -- connection should be re-established.
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Checking that IM-main processing commands...
--exec $UTIL/log.sh im_daemon_life_cycle Checking that IM-main processing commands...
--replace_column 2 STATE 3 VERSION_NUMBER 4 VERSION
SHOW INSTANCE STATUS mysqld1;
......@@ -86,13 +88,13 @@ SHOW INSTANCE STATUS mysqld1;
# So, if it we do not stop it, it will be stopped by mysql-test-run.pl with
# warning.
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: stopping...
--exec $UTIL/log.sh im_daemon_life_cycle mysqld2: stopping...
STOP INSTANCE mysqld2;
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: waiting to stop...
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 55 stopped im_daemon_life_cycle
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: stopped.
--exec $UTIL/log.sh im_daemon_life_cycle mysqld2: waiting to stop...
--exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 55 stopped im_daemon_life_cycle
--exec $UTIL/log.sh im_daemon_life_cycle mysqld2: stopped.
###########################################################################
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle BUG12751: done.
--exec $UTIL/log.sh im_daemon_life_cycle BUG12751: done.
......@@ -26,7 +26,7 @@
#
###########################################################################
--source include/im_check_env.inc
--source suite/im/t/im_check_env.inc
###########################################################################
#
......
let $UTIL=$MYSQL_TEST_DIR/suite/im/t;
###########################################################################
#
# This file contains test for (1.1) test suite.
......@@ -6,7 +8,7 @@
#
###########################################################################
--source include/im_check_env.inc
--source suite/im/t/im_check_env.inc
###########################################################################
#
......@@ -25,7 +27,7 @@
START INSTANCE mysqld2;
# FIXME: START INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_life_cycle
--exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_life_cycle
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
......@@ -58,7 +60,7 @@ SHOW VARIABLES LIKE 'port';
STOP INSTANCE mysqld2;
# FIXME: STOP INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped im_life_cycle
--exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped im_life_cycle
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
......@@ -121,7 +123,7 @@ STOP INSTANCE mysqld3;
--echo -- 1.1.6.
--echo --------------------------------------------------------------------
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted 30 im_life_cycle
--exec $UTIL/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted 30 im_life_cycle
# Give some time to IM to detect that mysqld was restarted. It should be
# longer than monitoring interval.
......@@ -143,7 +145,7 @@ SHOW INSTANCES;
START INSTANCE mysqld2;
# FIXME: START INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_life_cycle
--exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_life_cycle
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
......@@ -151,7 +153,7 @@ START INSTANCE mysqld2;
# mysqld has started.
# SHOW INSTANCES;
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed 10 im_life_cycle
--exec $UTIL/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed 10 im_life_cycle
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
......
......@@ -32,7 +32,7 @@
#
###########################################################################
--source include/im_check_env.inc
--source suite/im/t/im_check_env.inc
###########################################################################
#
......
......@@ -6,7 +6,9 @@
#
###########################################################################
--source include/im_check_env.inc
--source suite/im/t/im_check_env.inc
let $UTIL=$MYSQL_TEST_DIR/suite/im/t;
###########################################################################
......@@ -31,10 +33,10 @@ SHOW INSTANCE OPTIONS mysqld2;
#
START INSTANCE mysqld2;
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_utils
--exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_utils
STOP INSTANCE mysqld2;
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped im_utils
--exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped im_utils
#
# Check 'SHOW LOG FILES' command:
......
......@@ -22,4 +22,4 @@ ndb_partition_error2 : HF is not sure if the test can work as internded on all
#ndb_binlog_ddl_multi : BUG#18976 2006-04-10 kent CRBR: multiple binlog, second binlog may miss schema log events
#ndb_binlog_discover : bug#21806 2006-08-24
#ndb_autodiscover3 : bug#21806
ndb_autodiscover3 : Bug#20872 2007-07-15 ingo master*.err: miscellaneous error messages
#ndb_autodiscover3 : Bug#20872 2007-07-15 ingo master*.err: miscellaneous error messages
......@@ -17,6 +17,18 @@
--echo --- All SQL functions should be rejected, otherwise BUG (see 18198)
--echo -------------------------------------------------------------------------
let $sqlfunc = ascii(col1);
let $valsqlfunc = ascii('a');
let $coltype = char(30);
--source suite/parts/inc/partition_blocked_sql_funcs.inc
# --source include/partition_blocked_sql_funcs.inc
let $sqlfunc = ord(col1);
let $valsqlfunc = ord('a');
let $coltype = char(30);
--source suite/parts/inc/partition_blocked_sql_funcs.inc
# --source include/partition_blocked_sql_funcs.inc
let $sqlfunc = greatest(col1,15);
let $valsqlfunc = greatest(1,15);
let $coltype = int;
......@@ -151,12 +163,6 @@ let $coltype = int;
--source suite/parts/inc/partition_blocked_sql_funcs.inc
# --source include/partition_blocked_sql_funcs.inc
let $sqlfunc = datediff(col1,col1);
let $valsqlfunc = datediff('1997-11-30 23:59:59','1997-12-31');
let $coltype = datetime;
--source suite/parts/inc/partition_blocked_sql_funcs.inc
# --source include/partition_blocked_sql_funcs.inc
let $sqlfunc = period_add(col1,5);
let $valsqlfunc = period_add(9804,5);
let $coltype = datetime;
......@@ -190,6 +196,12 @@ let $coltype = datetime;
--source suite/parts/inc/partition_blocked_sql_funcs.inc
# --source include/partition_blocked_sql_funcs.inc
let $sqlfunc = weekofyear(col1);
let $valsqlfunc = weekofyear('2002-05-01');
let $coltype = datetime;
--source suite/parts/inc/partition_blocked_sql_funcs.inc
# --source include/partition_blocked_sql_funcs.inc
let $sqlfunc = cast(col1 as signed);
let $valsqlfunc = cast(123 as signed);
let $coltype = varchar(30);
......
......@@ -40,61 +40,42 @@ let $val4 = 15 ;
--source suite/parts/inc/partition_supported_sql_funcs.inc
# --source include/partition_supported_sql_funcs.inc
let $sqlfunc = ascii(col1);
let $valsqlfunc = ascii('5');
let $coltype = char(1);
let $infile = part_supported_sql_funcs_int_ch1.inc;
let $val1 = '1';
let $val2 = '9';
let $val3 = '3';
let $val4 = '8';
--source suite/parts/inc/partition_supported_sql_funcs.inc
# --source include/partition_supported_sql_funcs.inc
let $sqlfunc = cast(ceiling(col1) as signed integer);
let $valsqlfunc = cast(ceiling(15) as signed integer);
let $sqlfunc = ceiling(col1);
let $valsqlfunc = ceiling(15);
let $coltype = float(7,4);
let $infile = part_supported_sql_funcs_int_float.inc;
let $val1 = 5.1230;
let $val2 = 13.345;
let $val3 = 17.987;
let $val4 = 15.654 ;
--source suite/parts/inc/partition_supported_sql_funcs.inc
# DISABLED due to bug 30577
#--source suite/parts/inc/partition_supported_sql_funcs.inc
# --source include/partition_supported_sql_funcs.inc
let $sqlfunc = cast(floor(col1) as signed);
let $valsqlfunc = cast(floor(15.123) as signed);
let $sqlfunc = floor(col1);
let $valsqlfunc = floor(15.123);
let $coltype = float(7,4);
let $infile = part_supported_sql_funcs_int_float.inc;
let $val1 = 5.1230;
let $val2 = 13.345;
let $val3 = 17.987;
let $val4 = 15.654 ;
--source suite/parts/inc/partition_supported_sql_funcs.inc
# DISABLED due to bug 30577
#--source suite/parts/inc/partition_supported_sql_funcs.inc
# --source include/partition_supported_sql_funcs.inc
let $sqlfunc = cast(mod(col1,10) as signed);
let $valsqlfunc = cast(mod(15,10) as signed);
let $coltype = float(7,4);
let $infile = part_supported_sql_funcs_int_float.inc;
let $val1 = 5.0000;
let $sqlfunc = mod(col1,10);
let $valsqlfunc = mod(15,10);
let $coltype = int;
let $infile = part_supported_sql_funcs_int_int.inc;
let $val1 = 5;
let $val2 = 19;
let $val3 = 17;
let $val4 = 15 ;
--source suite/parts/inc/partition_supported_sql_funcs.inc
# --source include/partition_supported_sql_funcs.inc
let $sqlfunc = ord(col1);
let $valsqlfunc = ord('a');
let $coltype = char(3);
let $infile = part_supported_sql_funcs_int_ch1.inc;
let $val1 = '1';
let $val2 = '9';
let $val3 = '3';
let $val4 = '8';
--source suite/parts/inc/partition_supported_sql_funcs.inc
# --source include/partition_supported_sql_funcs.inc
let $sqlfunc = day(col1);
let $valsqlfunc = day('2006-12-21');
let $coltype = date;
......@@ -243,25 +224,26 @@ let $val4 = '2006-02-06';
--source suite/parts/inc/partition_supported_sql_funcs.inc
# --source include/partition_supported_sql_funcs.inc
let $sqlfunc = weekday(col1);
let $valsqlfunc = weekday('2006-10-14');
# DATEDIFF() is implemented as (TO_DAYS(d1) - TO_DAYS(d2))
let $sqlfunc = datediff(col1, '2006-01-01');
let $valsqlfunc = datediff('2006-02-02', '2006-01-01');
let $coltype = date;
let $infile = part_supported_sql_funcs_int_date.inc;
let $val1 = '2006-12-03';
let $val2 = '2006-11-17';
let $val3 = '2006-05-25';
let $val1 = '2006-02-03';
let $val2 = '2006-01-17';
let $val3 = '2006-01-25';
let $val4 = '2006-02-06';
--source suite/parts/inc/partition_supported_sql_funcs.inc
# --source include/partition_supported_sql_funcs.inc
let $sqlfunc = weekofyear(col1);
let $valsqlfunc = weekofyear('2006-02-14');
let $sqlfunc = weekday(col1);
let $valsqlfunc = weekday('2006-10-14');
let $coltype = date;
let $infile = part_supported_sql_funcs_int_date.inc;
let $val1 = '2006-01-03';
let $val2 = '2006-03-17';
let $val1 = '2006-12-03';
let $val2 = '2006-11-17';
let $val3 = '2006-05-25';
let $val4 = '2006-09-06';
let $val4 = '2006-02-06';
--source suite/parts/inc/partition_supported_sql_funcs.inc
# --source include/partition_supported_sql_funcs.inc
......
......@@ -43,16 +43,16 @@ SELECT IF(9999 - 1000 + 1 > @max_row, @max_row , 9999 - 1000 + 1)
ALTER TABLE t1 ADD PARTITION (PARTITION part2);
#
--echo # 1.1.2 Assign HASH partitioning
ALTER TABLE t1 PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER));
ALTER TABLE t1 PARTITION BY HASH(YEAR(f_date));
--source include/partition_layout.inc
--source suite/parts/inc/partition_check_read1.inc
#
--echo # 1.1.3 Assign other HASH partitioning to already partitioned table
--echo # + test and switch back + test
ALTER TABLE t1 PARTITION BY HASH(CAST(f_varchar AS SIGNED INTEGER));
ALTER TABLE t1 PARTITION BY HASH(DAYOFYEAR(f_date));
--source include/partition_layout.inc
--source suite/parts/inc/partition_check_read1.inc
ALTER TABLE t1 PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER));
ALTER TABLE t1 PARTITION BY HASH(YEAR(f_date));
--source include/partition_layout.inc
--source suite/parts/inc/partition_check_read1.inc
#
......
......@@ -36,8 +36,9 @@
eval $insert_first_half;
# Possible/Expected return codes for ALTER TABLE ...
# 0
# 1491: A PRIMARY KEY need to include all fields in the partition function
# A UNIQUE INDEX need to include all fields in the partition function
# 1030: ER_GET_ERRNO
# 1500: ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
# 1504: ER_DROP_PARTITION_NON_EXISTENT
--disable_abort_on_error
eval $alter;
--enable_abort_on_error
......@@ -47,11 +48,11 @@ if ($no_debug)
}
eval SET @my_errno = $mysql_errno;
let $run_test= `SELECT @my_errno = 0`;
let $unexpected_error= `SELECT @my_errno NOT IN (0,1030,1491,1495)`;
let $unexpected_error= `SELECT @my_errno NOT IN (0,1030,1500,1504)`;
if ($unexpected_error)
{
--echo # The last command got an unexepected error response.
--echo # Expected/handled SQL codes are 0,1030,1491,1495
--echo # Expected/handled SQL codes are 0,1030,1500,1504
SELECT '# SQL code we got was: ' AS "", @my_errno AS "";
--echo # Sorry, have to abort.
exit;
......
......@@ -15,8 +15,7 @@
--echo -------------------------------------------------------------------------
--echo --- $sqlfunc in partition with coltype $coltype
--echo -------------------------------------------------------------------------
--echo must all fail! (delete 0 and comment char, if bug fixed)
--disable_abort_on_error
--echo must all fail!
--disable_warnings
drop table if exists t1 ;
drop table if exists t2 ;
......@@ -26,32 +25,31 @@ drop table if exists t5 ;
drop table if exists t6 ;
--enable_warnings
#--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval create table t1 (col1 $coltype) engine=$engine
partition by range($sqlfunc)
(partition p0 values less than (15),
partition p1 values less than (31));
#--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval create table t2 (col1 $coltype) engine=$engine
partition by list($sqlfunc)
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
partition p2 values in (21,22,23,24,25,26,27,28,29,30));
#--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval create table t3 (col1 $coltype) engine=$engine
partition by hash($sqlfunc);
--enable_abort_on_error
--error 0,ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval create table t4 (colint int, col1 $coltype) engine=$engine
partition by range(colint)
subpartition by hash($sqlfunc) subpartitions 2
(partition p0 values less than (15),
partition p1 values less than (31));
--error 0,ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval create table t5 (colint int, col1 $coltype) engine=$engine
partition by list(colint)
subpartition by hash($sqlfunc) subpartitions 2
......@@ -59,7 +57,7 @@ subpartition by hash($sqlfunc) subpartitions 2
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
partition p2 values in (21,22,23,24,25,26,27,28,29,30));
--error 0,ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval create table t6 (colint int, col1 $coltype) engine=$engine
partition by range(colint)
(partition p0 values less than ($valsqlfunc),
......@@ -75,50 +73,44 @@ drop table if exists t55 ;
drop table if exists t66 ;
--enable_warnings
#--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval create table t11 (col1 $coltype) engine=$engine ;
#--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval create table t22 (col1 $coltype) engine=$engine ;
#--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval create table t33 (col1 $coltype) engine=$engine ;
--error 0,ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval create table t44 (colint int, col1 $coltype) engine=$engine ;
--error 0,ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval create table t55 (colint int, col1 $coltype) engine=$engine ;
--error 0,ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval create table t66 (colint int, col1 $coltype) engine=$engine ;
#--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval alter table t11
partition by range($sqlfunc)
(partition p0 values less than (15),
partition p1 values less than (31));
#--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval alter table t22
partition by list($sqlfunc)
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
partition p2 values in (21,22,23,24,25,26,27,28,29,30));
#--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval alter table t33
partition by hash($sqlfunc);
--enable_abort_on_error
--error 0,ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval alter table t44
partition by range(colint)
subpartition by hash($sqlfunc) subpartitions 2
(partition p0 values less than (15),
partition p1 values less than (31));
--error 0,ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval alter table t55
partition by list(colint)
subpartition by hash($sqlfunc) subpartitions 2
......@@ -126,7 +118,7 @@ subpartition by hash($sqlfunc) subpartitions 2
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
partition p2 values in (21,22,23,24,25,26,27,28,29,30));
--error 0,ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED,ER_PARSE_ERROR
eval alter table t66
partition by range(colint)
(partition p0 values less than ($valsqlfunc),
......
......@@ -156,8 +156,8 @@ if ($run)
# partitioning mechanism.
# Sideeffect: Attempt to INSERT one record
# DUPLICATE KEY will appear if we have UNIQUE columns
# 1022: Can't write; duplicate key in table 't1' UIDX/PK(f_int1)
# 1062: Duplicate entry '2' for key 1 UIDX/PK(f_int2)
# 1022: ER_DUP_KEY
# 1062: ER_DUP_ENTRY
--disable_abort_on_error
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
......@@ -200,7 +200,8 @@ if ($any_unique)
## 1.3.1 Check, if f_int1 is UNIQUE
# Sideeffect: Attempt to INSERT one record
# DUPLICATE KEY will appear if we have UNIQUE columns
# 1022: Can't write; duplicate key in table 't1' UIDX/PK
# 1022: ER_DUP_KEY
# 1062: ER_DUP_ENTRY
--disable_abort_on_error
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
......@@ -494,8 +495,9 @@ WHERE f_charbig = '#SINGLE#' AND f_int1 IN (-1,@cur_value);
# 4.7 Insert one record with such a big value for f_int1, so that in case
# - f_int1 is used within the partitioning algorithm
# - we use range partitioning
# we get error ER_NO_PARTITION_FOR_GIVEN_VALUE (1514)
# we get error ER_NO_PARTITION_FOR_GIVEN_VALUE (1523)
# "Table has no partition for value ...."
# or ER_SAME_NAME_PARTITION (1514)
--disable_abort_on_error
eval INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#$max_int_4##';
--enable_abort_on_error
......@@ -504,11 +506,11 @@ if ($no_debug)
--disable_query_log
}
eval SET @my_errno = $mysql_errno;
let $unexpected_error= `SELECT @my_errno NOT IN (0,1505,1514)`;
let $unexpected_error= `SELECT @my_errno NOT IN (0,1514,1523)`;
if ($unexpected_error)
{
--echo # The last command got an unexepected error response.
--echo # Expected/handled SQL codes are 0,1514
--echo # Expected/handled SQL codes are 0,1514,1523
SELECT '# SQL code we got was: ' AS "", @my_errno AS "";
--echo # Sorry, have to abort.
exit;
......@@ -555,8 +557,8 @@ INSERT t1 SET f_int1 = 0 , f_int2 = 0,
# f1 "=" NULL is a delicate value which might stress the partitioning
# mechanism if the result of the expression in the partitioning algorithm
# becomes NULL.
# Not: This INSERT will fail, if f_int1 is PRIMARY KEY or UNIQUE INDEX
# 1048: Column 'f_int1' cannot be null
# This INSERT will fail, if f_int1 is PRIMARY KEY or UNIQUE INDEX
# 1048: ER_BAD_NULL_ERROR
--disable_abort_on_error
INSERT INTO t1
......
......@@ -49,7 +49,7 @@ select * from t2;
drop table t2;
eval create table t3 (a date not null, primary key(a)) engine=$engine
partition by range (cast(month(a) as unsigned)) subpartition by key (a)
partition by range (month(a)) subpartition by key (a)
subpartitions 3 (
partition quarter1 values less than (4),
partition quarter2 values less than (7),
......@@ -69,7 +69,7 @@ select * from t3;
drop table t3;
eval create table t4 (a date not null, primary key(a)) engine=$engine
partition by list (cast(month(a) as unsigned)) subpartition by key (a)
partition by list (month(a)) subpartition by key (a)
subpartitions 3 (
partition quarter1 values in (1,2,3),
partition quarter2 values in (4,5,6),
......
......@@ -46,7 +46,7 @@ select * from t2;
drop table t2;
eval create table t3 (a datetime not null, primary key(a)) engine=$engine
partition by range (cast(month(a) as unsigned)) subpartition by key (a)
partition by range (month(a)) subpartition by key (a)
subpartitions 3 (
partition quarter1 values less than (4),
partition quarter2 values less than (7),
......@@ -66,7 +66,7 @@ select * from t3;
drop table t3;
eval create table t4 (a datetime not null, primary key(a)) engine=$engine
partition by list (cast(month(a) as unsigned)) subpartition by key (a)
partition by list (month(a)) subpartition by key (a)
subpartitions 3 (
partition quarter1 values in (1,2,3),
partition quarter2 values in (4,5,6),
......
......@@ -47,8 +47,15 @@ dec $count;
select count(*) from t2;
drop table t2;
# Bug 30577: FLOOR() and CEILING() not usable as partition functions
# Partition functions are required to return INT_RESULT; FLOOR() and
# CEILING() do not, unless they have an INT argument. Disable this
# portion of the test until bug 30577 is fixed.
--disable_parsing
eval create table t3 (a decimal(18,9) not null, primary key(a)) engine=$engine
partition by range (cast(floor(a) as signed)) subpartition by key (a) subpartitions 2 (
partition by range (floor(a)) subpartition by key (a) subpartitions 2 (
partition pa2 values less than (2),
partition pa4 values less than (4),
partition pa6 values less than (6),
......@@ -70,7 +77,7 @@ select count(*) from t3;
drop table t3;
eval create table t4 (a decimal(18,9) not null, primary key(a)) engine=$engine
partition by list (cast(floor(a) as signed)) subpartition by key (a) subpartitions 2 (
partition by list (floor(a)) subpartition by key (a) subpartitions 2 (
partition pa2 values in (1,2),
partition pa4 values in (3,4),
partition pa6 values in (5,6),
......@@ -90,3 +97,6 @@ dec $count;
--enable_query_log
select count(*) from t4;
drop table t4;
# Disabled due to Bug 30577
--enable_parsing
......@@ -29,9 +29,9 @@ let $partitioning= ;
if ($with_partitioning)
{
let $partitioning= PARTITION BY HASH(f_int1) PARTITIONS 2;
--disable_query_log
if ($with_directories)
{
--disable_query_log
eval SET @aux =
'PARTITION BY HASH(f_int1) PARTITIONS 2
(PARTITION p1
......@@ -39,7 +39,6 @@ $index_directory,
PARTITION p2
$index_directory)';
let $partitioning= `SELECT @aux`;
--enable_query_log
}
}
eval CREATE TABLE t1 (
......@@ -47,6 +46,7 @@ $column_list
$unique
)
$partitioning;
--enable_query_log
eval $insert_all;
--source suite/parts/inc/partition_check.inc
# --source include/partition_check.inc
......@@ -54,9 +54,9 @@ DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY KEY
--disable_query_log
if ($with_partitioning)
{
--disable_query_log
eval SET @aux =
'PARTITION BY KEY(f_int1) PARTITIONS 5';
let $partitioning= `SELECT @aux`;
......@@ -76,7 +76,6 @@ PARTITION p4,
PARTITION p5
$index_directory)';
let $partitioning= `SELECT @aux`;
--enable_query_log
}
}
eval CREATE TABLE t1 (
......@@ -84,6 +83,7 @@ $column_list
$unique
)
$partitioning;
--enable_query_log
eval $insert_all;
--source suite/parts/inc/partition_check.inc
# --source include/partition_check.inc
......@@ -91,9 +91,9 @@ DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY LIST
--disable_query_log
if ($with_partitioning)
{
--disable_query_log
eval SET @aux =
'PARTITION BY LIST(MOD(f_int1,4))
(PARTITION part_3 VALUES IN (-3)
......@@ -119,6 +119,7 @@ $column_list
$unique
)
$partitioning;
--enable_query_log
eval $insert_all;
--source suite/parts/inc/partition_check.inc
# --source include/partition_check.inc
......@@ -126,9 +127,9 @@ DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY RANGE
--disable_query_log
if ($with_partitioning)
{
#--disable_query_log
eval SET @aux = 'PARTITION BY RANGE(f_int1)
(PARTITION parta VALUES LESS THAN (0)
$index_directory,
......@@ -143,13 +144,13 @@ $data_directory,
PARTITION partf VALUES LESS THAN $MAX_VALUE
$index_directory)';
let $partitioning= `SELECT @aux`;
#--enable_query_log
}
eval CREATE TABLE t1 (
$column_list
$unique
)
$partitioning;
--enable_query_log
eval $insert_all;
--source suite/parts/inc/partition_check.inc
# --source include/partition_check.inc
......@@ -157,9 +158,9 @@ DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY RANGE -- SUBPARTITION BY HASH
--disable_query_log
if ($with_partitioning)
{
--disable_query_log
eval SET @aux =
'PARTITION BY RANGE(f_int1 DIV 2) SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2
(PARTITION parta VALUES LESS THAN (0)
......@@ -171,13 +172,13 @@ PARTITION partd VALUES LESS THAN $MAX_VALUE
$data_directory
$index_directory)';
let $partitioning= `SELECT @aux`;
--enable_query_log
}
eval CREATE TABLE t1 (
$column_list
$unique
)
$partitioning;
--enable_query_log
eval $insert_all;
--source suite/parts/inc/partition_check.inc
# --source include/partition_check.inc
......@@ -185,9 +186,9 @@ DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY RANGE -- SUBPARTITION BY KEY
--disable_query_log
if ($with_partitioning)
{
--disable_query_log
eval SET @aux = 'PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1)
(PARTITION part1 VALUES LESS THAN (0)
$data_directory
......@@ -202,13 +203,13 @@ $index_directory
PARTITION part4 VALUES LESS THAN $MAX_VALUE
(SUBPARTITION subpart41, SUBPARTITION subpart42))';
let $partitioning= `SELECT @aux`;
--enable_query_log
}
eval CREATE TABLE t1 (
$column_list
$unique
)
$partitioning;
--enable_query_log
eval $insert_all;
--source suite/parts/inc/partition_check.inc
# --source include/partition_check.inc
......@@ -216,9 +217,9 @@ DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY LIST -- SUBPARTITION BY HASH
--disable_query_log
if ($with_partitioning)
{
--disable_query_log
eval SET @aux =
'PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int1 + 1)
(PARTITION part1 VALUES IN (0)
......@@ -246,13 +247,13 @@ eval SET @aux =
$data_directory
$index_directory))';
let $partitioning= `SELECT @aux`;
--enable_query_log
}
eval CREATE TABLE t1 (
$column_list
$unique
)
$partitioning;
--enable_query_log
eval $insert_all;
--source suite/parts/inc/partition_check.inc
# --source include/partition_check.inc
......
......@@ -48,8 +48,15 @@ select count(*) from t2;
drop table t2;
# Bug 30577: FLOOR() and CEILING() not usable as partition functions
# Partition functions are required to return INT_RESULT; FLOOR() and
# CEILING() do not, unless they have an INT argument. Disable this
# portion of the test until bug 30577 is fixed.
--disable_parsing
eval create table t3 (a double not null, primary key(a)) engine=$engine
partition by range (cast(floor(a) as signed)) subpartition by key (a) subpartitions 3 (
partition by range (floor(a)) subpartition by key (a) subpartitions 3 (
partition pa1 values less than (3),
partition pa3 values less than (6),
partition pa10 values less than (10)
......@@ -69,7 +76,7 @@ select * from t3;
drop table t3;
eval create table t4 (a double not null, primary key(a)) engine=$engine
partition by list (cast(floor(a) as signed)) subpartition by key (a) subpartitions 3 (
partition by list (floor(a)) subpartition by key (a) subpartitions 3 (
partition pa1 values in (1,2,3),
partition pa3 values in (4,5,6),
partition pa10 values in (7,8,9,10)
......@@ -87,3 +94,6 @@ dec $count;
select count(*) from t4;
select * from t4;
drop table t4;
# Disabled due to Bug 30577
--enable_parsing
......@@ -56,6 +56,7 @@ eval INSERT INTO t0_definition SET state = 'old',
file_list = $file_list;
# Print the create table statement into the protocol
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SELECT create_command FROM t0_definition WHERE state = 'old';
if ($do_file_tests)
{
......
......@@ -55,6 +55,7 @@ let $run= `SELECT @aux`;
if ($run)
{
--vertical_results
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SELECT state,
REPLACE(create_command,'\n',' ') AS "Table definition",
REPLACE(file_list ,'\n',' ') AS "File list"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment