Merge fix and upstream.
This commit is contained in:
commit
b00e7d2d97
@ -13,80 +13,42 @@
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
||||||
|
/* See md5.c for explanation and copyright information. */
|
||||||
|
|
||||||
/* MD5.H - header file for MD5C.C
|
/*
|
||||||
|
* $FreeBSD: src/contrib/cvs/lib/md5.h,v 1.2 1999/12/11 15:10:02 peter Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
/* Unlike previous versions of this code, uint32 need not be exactly
|
||||||
rights reserved.
|
32 bits, merely 32 bits or more. Choosing a data type which is 32
|
||||||
|
bits instead of 64 is not important; speed is considerably more
|
||||||
|
important. ANSI guarantees that "unsigned long" will be big enough,
|
||||||
|
and always using it seems to have few disadvantages. */
|
||||||
|
typedef uint32 cvs_uint32;
|
||||||
|
|
||||||
License to copy and use this software is granted provided that it
|
|
||||||
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
|
|
||||||
Algorithm" in all material mentioning or referencing this software
|
|
||||||
or this function.
|
|
||||||
|
|
||||||
License is also granted to make and use derivative works provided
|
|
||||||
that such works are identified as "derived from the RSA Data
|
|
||||||
Security, Inc. MD5 Message-Digest Algorithm" in all material
|
|
||||||
mentioning or referencing the derived work.
|
|
||||||
|
|
||||||
RSA Data Security, Inc. makes no representations concerning either
|
|
||||||
the merchantability of this software or the suitability of this
|
|
||||||
software for any particular purpose. It is provided "as is"
|
|
||||||
without express or implied warranty of any kind.
|
|
||||||
|
|
||||||
These notices must be retained in any copies of any part of this
|
|
||||||
documentation and/or software.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* GLOBAL.H - RSAREF types and constants
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* PROTOTYPES should be set to one if and only if the compiler supports
|
|
||||||
function argument prototyping.
|
|
||||||
The following makes PROTOTYPES default to 0 if it has not already
|
|
||||||
been defined with C compiler flags.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* egcs 1.1.2 under linux didn't defined it.... :( */
|
|
||||||
|
|
||||||
#ifndef PROTOTYPES
|
|
||||||
#define PROTOTYPES 1 /* Assume prototypes */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* POINTER defines a generic pointer type */
|
|
||||||
typedef unsigned char *POINTER;
|
|
||||||
|
|
||||||
/* UINT2 defines a two byte word */
|
|
||||||
typedef uint16 UINT2; /* Fix for MySQL / Alpha */
|
|
||||||
|
|
||||||
/* UINT4 defines a four byte word */
|
|
||||||
typedef uint32 UINT4; /* Fix for MySQL / Alpha */
|
|
||||||
|
|
||||||
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
|
|
||||||
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
|
|
||||||
returns an empty list.
|
|
||||||
*/
|
|
||||||
#if PROTOTYPES
|
|
||||||
#define PROTO_LIST(list) list
|
|
||||||
#else
|
|
||||||
#define PROTO_LIST(list) ()
|
|
||||||
#endif
|
|
||||||
/* MD5 context. */
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT4 state[4]; /* state (ABCD) */
|
cvs_uint32 buf[4];
|
||||||
UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
|
cvs_uint32 bits[2];
|
||||||
unsigned char buffer[64]; /* input buffer */
|
unsigned char in[64];
|
||||||
} my_MD5_CTX;
|
} my_MD5Context;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void my_MD5Init PROTO_LIST ((my_MD5_CTX *));
|
void my_MD5Init (my_MD5Context *context);
|
||||||
void my_MD5Update PROTO_LIST
|
void my_MD5Update (my_MD5Context *context,
|
||||||
((my_MD5_CTX *, unsigned char *, unsigned int));
|
unsigned char const *buf, unsigned len);
|
||||||
void my_MD5Final PROTO_LIST ((unsigned char [16], my_MD5_CTX *));
|
void my_MD5Final (unsigned char digest[16],
|
||||||
|
my_MD5Context *context);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MY_MD5_HASH(digest,buf,len) \
|
||||||
|
do { \
|
||||||
|
my_MD5Context ctx; \
|
||||||
|
my_MD5Init (&ctx); \
|
||||||
|
my_MD5Update (&ctx, buf, len); \
|
||||||
|
my_MD5Final (digest, &ctx); \
|
||||||
|
} while (0)
|
||||||
|
@ -75,7 +75,7 @@ EXTRA_DIST = README \
|
|||||||
|
|
||||||
# List of directories containing test + result files and the
|
# List of directories containing test + result files and the
|
||||||
# related test data files that should be copied
|
# related test data files that should be copied
|
||||||
TEST_DIRS = t r include std_data std_data/parts \
|
TEST_DIRS = t r include std_data std_data/parts collections \
|
||||||
std_data/ndb_backup50 std_data/ndb_backup51 \
|
std_data/ndb_backup50 std_data/ndb_backup51 \
|
||||||
std_data/ndb_backup51_data_be std_data/ndb_backup51_data_le \
|
std_data/ndb_backup51_data_be std_data/ndb_backup51_data_le \
|
||||||
std_data/funcs_1 \
|
std_data/funcs_1 \
|
||||||
|
30
mysql-test/collections/README
Normal file
30
mysql-test/collections/README
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
This directory contains collections of test runs that we run during our
|
||||||
|
integration and release testing. Each file contains zero or more lines,
|
||||||
|
with one invocation of mysql-test-run.pl on each. These invocations are
|
||||||
|
written so that, with the assumption that perl is in your search path,
|
||||||
|
any collection can run as a shell script or a batch file, with the parent
|
||||||
|
mysql-test directory being the current working directory.
|
||||||
|
|
||||||
|
During integration testing, we choose the collection to run by following
|
||||||
|
these steps:
|
||||||
|
|
||||||
|
1) We choose the extension to look for, based on these rules:
|
||||||
|
- If we're running a per-push test, we choose ".push" as the extension.
|
||||||
|
- If we're running a daily test, we choose ".daily" as the extension.
|
||||||
|
- If we're running a weekly test, we choose ".weekly" as the extension.
|
||||||
|
|
||||||
|
2) If there is a collection that has the same name as the branch we're
|
||||||
|
testing plus the extension as determined in step 1, we choose that
|
||||||
|
collection.
|
||||||
|
|
||||||
|
3) If the branch is unknown or we have removed all characters from it
|
||||||
|
and still not found a matching collection, we choose the name "default"
|
||||||
|
plus the extension determined in step 1. If there is no such file,
|
||||||
|
we give up and don't test anything at all.
|
||||||
|
|
||||||
|
4) If we haven't found a collection yet, we remove the last character from
|
||||||
|
the branch name and go back to step 2.
|
||||||
|
|
||||||
|
5) The commands from the collection are run line by line via execv() or
|
||||||
|
similar system calls. They are not run as a shell script. Shell
|
||||||
|
expansions are not guaranteed to work and most likely won't.
|
25
mysql-test/collections/README.experimental
Normal file
25
mysql-test/collections/README.experimental
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
The .experimental files in this directory contain names of test cases that
|
||||||
|
are still in development and whose failures should be considered expected,
|
||||||
|
instead of regressions.
|
||||||
|
|
||||||
|
These files are to be used with the --experimental option of
|
||||||
|
mysql-test-run.pl. Please look at its help screen for usage information.
|
||||||
|
|
||||||
|
The syntax is as follows:
|
||||||
|
|
||||||
|
1) One line per test case.
|
||||||
|
|
||||||
|
2) Empty lines and lines starting with a hash (#) are ignored.
|
||||||
|
|
||||||
|
3) If any other line contains a blank followed by a hash (#), the hash
|
||||||
|
and any subsequent characters are ignored.
|
||||||
|
|
||||||
|
4) The full test case name including the suite and execution mode
|
||||||
|
must be specified, for example:
|
||||||
|
main.alias 'row' # bug#00000
|
||||||
|
|
||||||
|
5) As an exception to item 4, the last character of the test case
|
||||||
|
specification may be an asterisk (*). In that case, all test cases that
|
||||||
|
start with the same characters up to the last letter before the asterisk
|
||||||
|
are considered experimental:
|
||||||
|
main.a* # get rid of main.alias, main.alibaba and main.agliolio
|
1
mysql-test/collections/default.daily
Normal file
1
mysql-test/collections/default.daily
Normal file
@ -0,0 +1 @@
|
|||||||
|
perl mysql-test-run.pl --timer --force --comment=rpl_ndb_row --suite=rpl_ndb,ndb --mysqld=--binlog-format=row --experimental=collections/default.experimental
|
1
mysql-test/collections/default.experimental
Normal file
1
mysql-test/collections/default.experimental
Normal file
@ -0,0 +1 @@
|
|||||||
|
funcs_1.charset_collation_1 # depends on compile-time decisions
|
5
mysql-test/collections/default.push
Normal file
5
mysql-test/collections/default.push
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
perl mysql-test-run.pl --timer --force --comment=n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental
|
||||||
|
perl mysql-test-run.pl --timer --force --comment=ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental
|
||||||
|
perl mysql-test-run.pl --timer --force --comment=embedded --embedded --experimental=collections/default.experimental
|
||||||
|
perl mysql-test-run.pl --timer --force --comment=rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental
|
||||||
|
perl mysql-test-run.pl --timer --force --comment=funcs_1 --suite=funcs_1 --experimental=collections/default.experimental
|
0
mysql-test/collections/default.weekly
Normal file
0
mysql-test/collections/default.weekly
Normal file
@ -26,7 +26,7 @@ create temporary table error_log (
|
|||||||
) engine=myisam;
|
) engine=myisam;
|
||||||
|
|
||||||
# Get the name of servers error log
|
# Get the name of servers error log
|
||||||
let $log_error= query_get_value(show variables like 'log_error', Value, 1);
|
let $log_error= $MTR_LOG_ERROR;
|
||||||
let $log_warning= $log_error.warnings;
|
let $log_warning= $log_error.warnings;
|
||||||
|
|
||||||
# Try tload the warnings into a temporary table,
|
# Try tload the warnings into a temporary table,
|
||||||
|
@ -116,8 +116,8 @@ sub fix_tmpdir {
|
|||||||
|
|
||||||
sub fix_log_error {
|
sub fix_log_error {
|
||||||
my ($self, $config, $group_name, $group)= @_;
|
my ($self, $config, $group_name, $group)= @_;
|
||||||
my $dir= dirname($group->value('datadir'));
|
my $dir= $self->{ARGS}->{vardir};
|
||||||
return "$dir/mysqld.err";
|
return "$dir/log/$group_name.err";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub fix_log {
|
sub fix_log {
|
||||||
@ -203,7 +203,7 @@ my @mysqld_rules=
|
|||||||
{ '#host' => \&fix_host },
|
{ '#host' => \&fix_host },
|
||||||
{ 'port' => \&fix_port },
|
{ 'port' => \&fix_port },
|
||||||
{ 'socket' => \&fix_socket },
|
{ 'socket' => \&fix_socket },
|
||||||
{ 'log-error' => \&fix_log_error },
|
{ '#log-error' => \&fix_log_error },
|
||||||
{ 'log' => \&fix_log },
|
{ 'log' => \&fix_log },
|
||||||
{ 'log-slow-queries' => \&fix_log_slow_queries },
|
{ 'log-slow-queries' => \&fix_log_slow_queries },
|
||||||
{ '#user' => sub { return shift->{ARGS}->{user} || ""; } },
|
{ '#user' => sub { return shift->{ARGS}->{user} || ""; } },
|
||||||
@ -389,7 +389,7 @@ sub post_check_embedded_group {
|
|||||||
|
|
||||||
my @no_copy =
|
my @no_copy =
|
||||||
(
|
(
|
||||||
'log-error', # Embedded server writes stderr to mysqltest's log file
|
'#log-error', # Embedded server writes stderr to mysqltest's log file
|
||||||
'slave-net-timeout', # Embedded server are not build with replication
|
'slave-net-timeout', # Embedded server are not build with replication
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -113,8 +113,8 @@ sub check_socket_path_length {
|
|||||||
|
|
||||||
# Create a tempfile name with same length as "path"
|
# Create a tempfile name with same length as "path"
|
||||||
my $tmpdir = tempdir( CLEANUP => 0);
|
my $tmpdir = tempdir( CLEANUP => 0);
|
||||||
my $len = length($path) - length($tmpdir);
|
my $len = length($path) - length($tmpdir) - 1;
|
||||||
my $testfile = $tmpdir . "x" x ($len > 0 ? $len : 1);
|
my $testfile = $tmpdir . "/" . "x" x ($len > 0 ? $len : 1);
|
||||||
my $sock;
|
my $sock;
|
||||||
eval {
|
eval {
|
||||||
$sock= new IO::Socket::UNIX
|
$sock= new IO::Socket::UNIX
|
||||||
@ -126,17 +126,15 @@ sub check_socket_path_length {
|
|||||||
die "Could not create UNIX domain socket: $!"
|
die "Could not create UNIX domain socket: $!"
|
||||||
unless defined $sock;
|
unless defined $sock;
|
||||||
|
|
||||||
die "UNIX domain socket patch was truncated"
|
die "UNIX domain socket path was truncated"
|
||||||
unless ($testfile eq $sock->hostpath());
|
unless ($testfile eq $sock->hostpath());
|
||||||
|
|
||||||
$truncated= 0; # Yes, it worked!
|
$truncated= 0; # Yes, it worked!
|
||||||
|
|
||||||
};
|
};
|
||||||
#print "check_socket_path_length, failed: ", $@, '\n' if ($@);
|
|
||||||
|
|
||||||
$sock= undef; # Close socket
|
$sock= undef; # Close socket
|
||||||
unlink($testfile); # Remove the physical file
|
rmtree($tmpdir); # Remove the tempdir and any socket file created
|
||||||
rmdir($tmpdir); # Remove the tempdir
|
|
||||||
return $truncated;
|
return $truncated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +117,7 @@ sub new {
|
|||||||
my $output = delete($opts{'output'});
|
my $output = delete($opts{'output'});
|
||||||
my $error = delete($opts{'error'});
|
my $error = delete($opts{'error'});
|
||||||
my $verbose = delete($opts{'verbose'});
|
my $verbose = delete($opts{'verbose'});
|
||||||
|
my $nocore = delete($opts{'nocore'});
|
||||||
my $host = delete($opts{'host'});
|
my $host = delete($opts{'host'});
|
||||||
my $shutdown = delete($opts{'shutdown'});
|
my $shutdown = delete($opts{'shutdown'});
|
||||||
my $user_data= delete($opts{'user_data'});
|
my $user_data= delete($opts{'user_data'});
|
||||||
@ -137,6 +138,7 @@ sub new {
|
|||||||
push(@safe_args, $safe_script) if defined $safe_script;
|
push(@safe_args, $safe_script) if defined $safe_script;
|
||||||
|
|
||||||
push(@safe_args, "--verbose") if $verbose > 0;
|
push(@safe_args, "--verbose") if $verbose > 0;
|
||||||
|
push(@safe_args, "--nocore") if $nocore;
|
||||||
|
|
||||||
# Point the safe_process at the right parent if running on cygwin
|
# Point the safe_process at the right parent if running on cygwin
|
||||||
push(@safe_args, "--parent-pid=".Cygwin::pid_to_winpid($$)) if IS_CYGWIN;
|
push(@safe_args, "--parent-pid=".Cygwin::pid_to_winpid($$)) if IS_CYGWIN;
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <sys/resource.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -149,6 +150,7 @@ int main(int argc, char* const argv[] )
|
|||||||
char* const* child_argv= 0;
|
char* const* child_argv= 0;
|
||||||
pid_t own_pid= getpid();
|
pid_t own_pid= getpid();
|
||||||
pid_t parent_pid= getppid();
|
pid_t parent_pid= getppid();
|
||||||
|
bool nocore = false;
|
||||||
|
|
||||||
/* Install signal handlers */
|
/* Install signal handlers */
|
||||||
signal(SIGTERM, handle_signal);
|
signal(SIGTERM, handle_signal);
|
||||||
@ -181,6 +183,9 @@ int main(int argc, char* const argv[] )
|
|||||||
start++; /* Step past = */
|
start++; /* Step past = */
|
||||||
if ((parent_pid= atoi(start)) == 0)
|
if ((parent_pid= atoi(start)) == 0)
|
||||||
die("Invalid value '%s' passed to --parent-id", start);
|
die("Invalid value '%s' passed to --parent-id", start);
|
||||||
|
} else if ( strcmp(arg, "--nocore") == 0 )
|
||||||
|
{
|
||||||
|
nocore = true; // Don't allow the process to dump core
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
die("Unknown option: %s", arg);
|
die("Unknown option: %s", arg);
|
||||||
@ -218,6 +223,15 @@ int main(int argc, char* const argv[] )
|
|||||||
// it and any childs(that hasn't changed group themself)
|
// it and any childs(that hasn't changed group themself)
|
||||||
setpgid(0, 0);
|
setpgid(0, 0);
|
||||||
|
|
||||||
|
if (nocore)
|
||||||
|
{
|
||||||
|
struct rlimit corelim = { 0, 0 };
|
||||||
|
if (setrlimit (RLIMIT_CORE, &corelim) < 0)
|
||||||
|
{
|
||||||
|
message("setrlimit failed, errno=%d", errno);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Signal that child is ready
|
// Signal that child is ready
|
||||||
buf= 37;
|
buf= 37;
|
||||||
write(pfd[1], &buf, 1);
|
write(pfd[1], &buf, 1);
|
||||||
|
@ -69,6 +69,8 @@ sub _mtr_report_test_name ($) {
|
|||||||
|
|
||||||
print _name(), _timestamp();
|
print _name(), _timestamp();
|
||||||
printf "%-40s ", $tname;
|
printf "%-40s ", $tname;
|
||||||
|
|
||||||
|
return $tname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -105,20 +107,48 @@ sub mtr_report_test_passed ($) {
|
|||||||
|
|
||||||
sub mtr_report_test ($) {
|
sub mtr_report_test ($) {
|
||||||
my ($tinfo)= @_;
|
my ($tinfo)= @_;
|
||||||
_mtr_report_test_name($tinfo);
|
my $test_name = _mtr_report_test_name($tinfo);
|
||||||
|
|
||||||
my $comment= $tinfo->{'comment'};
|
my $comment= $tinfo->{'comment'};
|
||||||
my $logfile= $tinfo->{'logfile'};
|
my $logfile= $tinfo->{'logfile'};
|
||||||
my $warnings= $tinfo->{'warnings'};
|
my $warnings= $tinfo->{'warnings'};
|
||||||
my $result= $tinfo->{'result'};
|
my $result= $tinfo->{'result'};
|
||||||
|
my $retry= $tinfo->{'retries'} ? "retry-" : "";
|
||||||
|
|
||||||
if ($result eq 'MTR_RES_FAILED'){
|
if ($result eq 'MTR_RES_FAILED'){
|
||||||
|
|
||||||
my $timest = format_time();
|
my $timest = format_time();
|
||||||
|
my $fail = "fail";
|
||||||
|
|
||||||
|
if ( $::opt_experimental )
|
||||||
|
{
|
||||||
|
# Find out if this test case is an experimental one, so we can treat
|
||||||
|
# the failure as an expected failure instead of a regression.
|
||||||
|
for my $exp ( @$::experimental_test_cases ) {
|
||||||
|
if ( $exp ne $test_name ) {
|
||||||
|
# if the expression is not the name of this test case, but has
|
||||||
|
# an asterisk at the end, determine if the characters up to
|
||||||
|
# but excluding the asterisk are the same
|
||||||
|
if ( $exp ne "" && substr($exp, -1, 1) eq "*" ) {
|
||||||
|
$exp = substr($exp, 0, length($exp) - 1);
|
||||||
|
if ( substr($test_name, 0, length($exp)) ne $exp ) {
|
||||||
|
# no match, try next entry
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
# if yes, fall through to set the exp-fail status
|
||||||
|
} else {
|
||||||
|
# no match, try next entry
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$fail = "exp-fail";
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( $warnings )
|
if ( $warnings )
|
||||||
{
|
{
|
||||||
mtr_report("[ fail ] Found warnings/errors in server log file!");
|
mtr_report("[ $retry$fail ] Found warnings/errors in server log file!");
|
||||||
mtr_report(" Test ended at $timest");
|
mtr_report(" Test ended at $timest");
|
||||||
mtr_report($warnings);
|
mtr_report($warnings);
|
||||||
return;
|
return;
|
||||||
@ -126,14 +156,14 @@ sub mtr_report_test ($) {
|
|||||||
my $timeout= $tinfo->{'timeout'};
|
my $timeout= $tinfo->{'timeout'};
|
||||||
if ( $timeout )
|
if ( $timeout )
|
||||||
{
|
{
|
||||||
mtr_report("[ fail ] timeout after $timeout seconds");
|
mtr_report("[ $retry$fail ] timeout after $timeout seconds");
|
||||||
mtr_report(" Test ended at $timest");
|
mtr_report(" Test ended at $timest");
|
||||||
mtr_report("\n$tinfo->{'comment'}");
|
mtr_report("\n$tinfo->{'comment'}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mtr_report("[ fail ]\n Test ended at $timest");
|
mtr_report("[ $retry$fail ]\n Test ended at $timest");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $logfile )
|
if ( $logfile )
|
||||||
@ -176,7 +206,7 @@ sub mtr_report_test ($) {
|
|||||||
{
|
{
|
||||||
my $timer_str= $tinfo->{timer} || "";
|
my $timer_str= $tinfo->{timer} || "";
|
||||||
$tot_real_time += ($timer_str/1000);
|
$tot_real_time += ($timer_str/1000);
|
||||||
mtr_report("[ pass ] ", sprintf("%5s", $timer_str));
|
mtr_report("[ ${retry}pass ] ", sprintf("%5s", $timer_str));
|
||||||
|
|
||||||
# Show any problems check-testcase found
|
# Show any problems check-testcase found
|
||||||
if ( defined $tinfo->{'check'} )
|
if ( defined $tinfo->{'check'} )
|
||||||
|
@ -188,6 +188,8 @@ sub mtr_release_unique_id($) {
|
|||||||
|
|
||||||
flock SEM, LOCK_UN or warn "can't unlock $file.sem";
|
flock SEM, LOCK_UN or warn "can't unlock $file.sem";
|
||||||
close SEM;
|
close SEM;
|
||||||
|
|
||||||
|
delete $mtr_unique_ids{$$};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -181,12 +181,18 @@ our $opt_client_debugger;
|
|||||||
my $config; # The currently running config
|
my $config; # The currently running config
|
||||||
my $current_config_name; # The currently running config file template
|
my $current_config_name; # The currently running config file template
|
||||||
|
|
||||||
|
our $opt_experimental;
|
||||||
|
our $experimental_test_cases;
|
||||||
|
|
||||||
my $baseport;
|
my $baseport;
|
||||||
my $opt_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto";
|
my $opt_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto";
|
||||||
|
my $build_thread= 0;
|
||||||
|
|
||||||
my $opt_record;
|
my $opt_record;
|
||||||
my $opt_report_features;
|
my $opt_report_features;
|
||||||
|
|
||||||
|
my $opt_skip_core;
|
||||||
|
|
||||||
our $opt_check_testcases= 1;
|
our $opt_check_testcases= 1;
|
||||||
my $opt_mark_progress;
|
my $opt_mark_progress;
|
||||||
|
|
||||||
@ -677,14 +683,9 @@ sub run_worker ($) {
|
|||||||
report_option('name',"worker[$thread_num]");
|
report_option('name',"worker[$thread_num]");
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Use auto build thread in all but first worker
|
# Set different ports per thread
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
set_build_thread_ports($thread_num > 1 ? 'auto' : $opt_build_thread);
|
set_build_thread_ports($thread_num);
|
||||||
|
|
||||||
if (check_ports_free()){
|
|
||||||
# Some port was not free(which one has already been printed)
|
|
||||||
mtr_error("Some port(s) was not free")
|
|
||||||
}
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Turn off verbosity in workers, unless explicitly specified
|
# Turn off verbosity in workers, unless explicitly specified
|
||||||
@ -804,7 +805,7 @@ sub command_line_setup {
|
|||||||
'big-test' => \$opt_big_test,
|
'big-test' => \$opt_big_test,
|
||||||
'combination=s' => \@opt_combinations,
|
'combination=s' => \@opt_combinations,
|
||||||
'skip-combinations' => \&collect_option,
|
'skip-combinations' => \&collect_option,
|
||||||
|
'experimental=s' => \$opt_experimental,
|
||||||
'skip-im' => \&ignore_option,
|
'skip-im' => \&ignore_option,
|
||||||
|
|
||||||
# Specify ports
|
# Specify ports
|
||||||
@ -944,12 +945,12 @@ sub command_line_setup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Look for language files and charsetsdir, use same share
|
# Look for language files and charsetsdir, use same share
|
||||||
my $path_share= mtr_path_exists("$basedir/share/mysql",
|
$path_language= mtr_path_exists("$basedir/share/mysql/english",
|
||||||
"$basedir/sql/share",
|
"$basedir/sql/share/english",
|
||||||
"$basedir/share");
|
"$basedir/share/english");
|
||||||
|
|
||||||
|
|
||||||
$path_language= mtr_path_exists("$path_share/english");
|
my $path_share= dirname($path_language);
|
||||||
$path_charsetsdir= mtr_path_exists("$path_share/charsets");
|
$path_charsetsdir= mtr_path_exists("$path_share/charsets");
|
||||||
|
|
||||||
if (using_extern())
|
if (using_extern())
|
||||||
@ -971,6 +972,33 @@ sub command_line_setup {
|
|||||||
mtr_print_thick_line('#');
|
mtr_print_thick_line('#');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $opt_experimental )
|
||||||
|
{
|
||||||
|
# read the list of experimental test cases from the file specified on
|
||||||
|
# the command line
|
||||||
|
open(FILE, "<", $opt_experimental) or mtr_error("Can't read experimental file: $opt_experimental");
|
||||||
|
mtr_report("Using experimental file: $opt_experimental");
|
||||||
|
$experimental_test_cases = [];
|
||||||
|
while(<FILE>) {
|
||||||
|
chomp;
|
||||||
|
# remove comments (# foo) at the beginning of the line, or after a
|
||||||
|
# blank at the end of the line
|
||||||
|
s/( +|^)#.*$//;
|
||||||
|
# remove whitespace
|
||||||
|
s/^ +//;
|
||||||
|
s/ +$//;
|
||||||
|
# if nothing left, don't need to remember this line
|
||||||
|
if ( $_ eq "" ) {
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
# remember what is left as the name of another test case that should be
|
||||||
|
# treated as experimental
|
||||||
|
print " - $_\n";
|
||||||
|
push @$experimental_test_cases, $_;
|
||||||
|
}
|
||||||
|
close FILE;
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $arg ( @ARGV )
|
foreach my $arg ( @ARGV )
|
||||||
{
|
{
|
||||||
if ( $arg =~ /^--skip-/ )
|
if ( $arg =~ /^--skip-/ )
|
||||||
@ -1094,6 +1122,14 @@ sub command_line_setup {
|
|||||||
$opt_shutdown_timeout= 0; # Kill processes instead of nice shutdown
|
$opt_shutdown_timeout= 0; # Kill processes instead of nice shutdown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# Check parallel value
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
if ($opt_parallel < 1)
|
||||||
|
{
|
||||||
|
mtr_error("0 or negative parallel value makes no sense, use positive number");
|
||||||
|
}
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Record flag
|
# Record flag
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
@ -1283,18 +1319,32 @@ sub command_line_setup {
|
|||||||
# But a fairly safe range seems to be 5001 - 32767
|
# But a fairly safe range seems to be 5001 - 32767
|
||||||
#
|
#
|
||||||
sub set_build_thread_ports($) {
|
sub set_build_thread_ports($) {
|
||||||
my $build_thread= shift || 0;
|
my $thread= shift || 0;
|
||||||
|
|
||||||
if ( lc($build_thread) eq 'auto' ) {
|
if ( lc($opt_build_thread) eq 'auto' ) {
|
||||||
#mtr_report("Requesting build thread... ");
|
my $found_free = 0;
|
||||||
$build_thread= mtr_get_unique_id(250, 299);
|
$build_thread = 250; # Start attempts from here
|
||||||
|
while (! $found_free)
|
||||||
|
{
|
||||||
|
$build_thread= mtr_get_unique_id($build_thread, 299);
|
||||||
if ( !defined $build_thread ) {
|
if ( !defined $build_thread ) {
|
||||||
mtr_error("Could not get a unique build thread id");
|
mtr_error("Could not get a unique build thread id");
|
||||||
}
|
}
|
||||||
#mtr_report(" - got $build_thread");
|
$found_free= check_ports_free($build_thread);
|
||||||
|
# If not free, release and try from next number
|
||||||
|
mtr_release_unique_id($build_thread++) unless $found_free;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$build_thread = $opt_build_thread + $thread - 1;
|
||||||
}
|
}
|
||||||
$ENV{MTR_BUILD_THREAD}= $build_thread;
|
$ENV{MTR_BUILD_THREAD}= $build_thread;
|
||||||
$opt_build_thread= $build_thread;
|
|
||||||
|
if (! check_ports_free($build_thread)) {
|
||||||
|
# Some port was not free(which one has already been printed)
|
||||||
|
mtr_error("Some port(s) was not free")
|
||||||
|
}
|
||||||
|
|
||||||
# Calculate baseport
|
# Calculate baseport
|
||||||
$baseport= $build_thread * 10 + 10000;
|
$baseport= $build_thread * 10 + 10000;
|
||||||
@ -2448,22 +2498,18 @@ sub kill_leftovers ($) {
|
|||||||
# Check that all the ports that are going to
|
# Check that all the ports that are going to
|
||||||
# be used are free
|
# be used are free
|
||||||
#
|
#
|
||||||
sub check_ports_free
|
sub check_ports_free ($)
|
||||||
{
|
{
|
||||||
my @ports_to_check;
|
my $bthread= shift;
|
||||||
for ($baseport..$baseport+9){
|
my $portbase = $bthread * 10 + 10000;
|
||||||
push(@ports_to_check, $_);
|
for ($portbase..$portbase+9){
|
||||||
}
|
if (mtr_ping_port($_)){
|
||||||
#mtr_report("Checking ports...");
|
mtr_report(" - 'localhost:$_' was not free");
|
||||||
# print "@ports_to_check\n";
|
return 0; # One port was not free
|
||||||
foreach my $port (@ports_to_check){
|
|
||||||
if (mtr_ping_port($port)){
|
|
||||||
mtr_report(" - 'localhost:$port' was not free");
|
|
||||||
return 1; # One port was not free
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0; # All ports free
|
return 1; # All ports free
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3482,7 +3528,10 @@ sub start_check_warnings ($$) {
|
|||||||
|
|
||||||
my $name= "warnings-".$mysqld->name();
|
my $name= "warnings-".$mysqld->name();
|
||||||
|
|
||||||
extract_warning_lines($mysqld->value('log-error'));
|
my $log_error= $mysqld->value('#log-error');
|
||||||
|
# To be communicated to the test
|
||||||
|
$ENV{MTR_LOG_ERROR}= $log_error;
|
||||||
|
extract_warning_lines($log_error);
|
||||||
|
|
||||||
my $args;
|
my $args;
|
||||||
mtr_init_args(\$args);
|
mtr_init_args(\$args);
|
||||||
@ -3957,6 +4006,7 @@ sub mysqld_arguments ($$$) {
|
|||||||
mtr_add_arg($args, "%s", $arg);
|
mtr_add_arg($args, "%s", $arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$opt_skip_core = $found_skip_core;
|
||||||
if ( !$found_skip_core )
|
if ( !$found_skip_core )
|
||||||
{
|
{
|
||||||
mtr_add_arg($args, "%s", "--core-file");
|
mtr_add_arg($args, "%s", "--core-file");
|
||||||
@ -3996,6 +4046,12 @@ sub mysqld_start ($$) {
|
|||||||
$path_vardir_trace, $mysqld->name());
|
$path_vardir_trace, $mysqld->name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IS_WINDOWS)
|
||||||
|
{
|
||||||
|
# Trick the server to send output to stderr, with --console
|
||||||
|
mtr_add_arg($args, "--console");
|
||||||
|
}
|
||||||
|
|
||||||
if ( $opt_gdb || $opt_manual_gdb )
|
if ( $opt_gdb || $opt_manual_gdb )
|
||||||
{
|
{
|
||||||
gdb_arguments(\$args, \$exe, $mysqld->name());
|
gdb_arguments(\$args, \$exe, $mysqld->name());
|
||||||
@ -4028,7 +4084,7 @@ sub mysqld_start ($$) {
|
|||||||
# Remove the old pidfile if any
|
# Remove the old pidfile if any
|
||||||
unlink($mysqld->value('pid-file'));
|
unlink($mysqld->value('pid-file'));
|
||||||
|
|
||||||
my $output= $mysqld->value('log-error');
|
my $output= $mysqld->value('#log-error');
|
||||||
if ( $opt_valgrind and $opt_debug )
|
if ( $opt_valgrind and $opt_debug )
|
||||||
{
|
{
|
||||||
# When both --valgrind and --debug is selected, send
|
# When both --valgrind and --debug is selected, send
|
||||||
@ -4048,6 +4104,7 @@ sub mysqld_start ($$) {
|
|||||||
error => $output,
|
error => $output,
|
||||||
append => 1,
|
append => 1,
|
||||||
verbose => $opt_verbose,
|
verbose => $opt_verbose,
|
||||||
|
nocore => $opt_skip_core,
|
||||||
host => undef,
|
host => undef,
|
||||||
shutdown => sub { mysqld_stop($mysqld) },
|
shutdown => sub { mysqld_stop($mysqld) },
|
||||||
);
|
);
|
||||||
@ -4100,12 +4157,6 @@ sub server_need_restart {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $opt_embedded_server )
|
|
||||||
{
|
|
||||||
mtr_verbose_restart($server, "no start or restart for embedded server");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $tinfo->{'force_restart'} ) {
|
if ( $tinfo->{'force_restart'} ) {
|
||||||
mtr_verbose_restart($server, "forced in .opt file");
|
mtr_verbose_restart($server, "forced in .opt file");
|
||||||
return 1;
|
return 1;
|
||||||
@ -4335,7 +4386,7 @@ sub start_servers($) {
|
|||||||
# Already started
|
# Already started
|
||||||
|
|
||||||
# Write start of testcase to log file
|
# Write start of testcase to log file
|
||||||
mark_log($mysqld->value('log-error'), $tinfo);
|
mark_log($mysqld->value('#log-error'), $tinfo);
|
||||||
|
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
@ -4394,7 +4445,7 @@ sub start_servers($) {
|
|||||||
mkpath($tmpdir) unless -d $tmpdir;
|
mkpath($tmpdir) unless -d $tmpdir;
|
||||||
|
|
||||||
# Write start of testcase to log file
|
# Write start of testcase to log file
|
||||||
mark_log($mysqld->value('log-error'), $tinfo);
|
mark_log($mysqld->value('#log-error'), $tinfo);
|
||||||
|
|
||||||
# Run <tname>-master.sh
|
# Run <tname>-master.sh
|
||||||
if ($mysqld->option('#!run-master-sh') and
|
if ($mysqld->option('#!run-master-sh') and
|
||||||
@ -4445,7 +4496,7 @@ sub start_servers($) {
|
|||||||
$tinfo->{comment}=
|
$tinfo->{comment}=
|
||||||
"Failed to start ".$mysqld->name();
|
"Failed to start ".$mysqld->name();
|
||||||
|
|
||||||
my $logfile= $mysqld->value('log-error');
|
my $logfile= $mysqld->value('#log-error');
|
||||||
if ( defined $logfile and -f $logfile )
|
if ( defined $logfile and -f $logfile )
|
||||||
{
|
{
|
||||||
$tinfo->{logfile}= mtr_fromfile($logfile);
|
$tinfo->{logfile}= mtr_fromfile($logfile);
|
||||||
|
@ -736,6 +736,17 @@ select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mo
|
|||||||
select name from mysql.event where name = 'p' and sql_mode = @full_mode;
|
select name from mysql.event where name = 'p' and sql_mode = @full_mode;
|
||||||
name
|
name
|
||||||
drop event e1;
|
drop event e1;
|
||||||
|
SET @old_server_id = @@GLOBAL.server_id;
|
||||||
|
SET GLOBAL server_id = (1 << 32) - 1;
|
||||||
|
SELECT @@GLOBAL.server_id;
|
||||||
|
@@GLOBAL.server_id
|
||||||
|
4294967295
|
||||||
|
CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
|
||||||
|
SELECT event_name, originator FROM INFORMATION_SCHEMA.EVENTS;
|
||||||
|
event_name originator
|
||||||
|
ev1 4294967295
|
||||||
|
DROP EVENT ev1;
|
||||||
|
SET GLOBAL server_id = @old_server_id;
|
||||||
DROP DATABASE events_test;
|
DROP DATABASE events_test;
|
||||||
SET GLOBAL event_scheduler= 'ON';
|
SET GLOBAL event_scheduler= 'ON';
|
||||||
SET @@global.concurrent_insert= @concurrent_insert;
|
SET @@global.concurrent_insert= @concurrent_insert;
|
||||||
|
@ -155,6 +155,10 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
|
Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
|
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||||
|
EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a);
|
||||||
|
ERROR 42000: Key 'a' doesn't exist in table 't1'
|
||||||
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# Bug#37870: Usage of uninitialized value caused failed assertion.
|
# Bug#37870: Usage of uninitialized value caused failed assertion.
|
||||||
#
|
#
|
||||||
@ -182,3 +186,4 @@ dt
|
|||||||
2001-01-01 01:01:01
|
2001-01-01 01:01:01
|
||||||
2001-01-01 01:01:01
|
2001-01-01 01:01:01
|
||||||
drop tables t1, t2;
|
drop tables t1, t2;
|
||||||
|
End of 5.1 tests.
|
||||||
|
@ -579,3 +579,291 @@ c1
|
|||||||
18446744073709551610
|
18446744073709551610
|
||||||
18446744073709551615
|
18446744073709551615
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||||
|
SET @@INSERT_ID=1;
|
||||||
|
SHOW VARIABLES LIKE "%auto_inc%";
|
||||||
|
Variable_name Value
|
||||||
|
auto_increment_increment 1
|
||||||
|
auto_increment_offset 1
|
||||||
|
CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES(NULL, 1);
|
||||||
|
INSERT INTO t1 VALUES(NULL, 2);
|
||||||
|
SELECT * FROM t1;
|
||||||
|
c1 c2
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
ALTER TABLE t1 CHANGE c1 c1 SERIAL;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
c1 c2
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
INSERT INTO t1 VALUES(NULL, 3);
|
||||||
|
INSERT INTO t1 VALUES(NULL, 4);
|
||||||
|
SELECT * FROM t1;
|
||||||
|
c1 c2
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
3 3
|
||||||
|
4 4
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
CREATE TABLE t1 (c1 FLOAT NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES(NULL, 1);
|
||||||
|
INSERT INTO t1 VALUES(NULL, 2);
|
||||||
|
SELECT * FROM t1;
|
||||||
|
c1 c2
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
ALTER TABLE t1 CHANGE c1 c1 SERIAL;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
c1 c2
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
INSERT INTO t1 VALUES(NULL, 3);
|
||||||
|
INSERT INTO t1 VALUES(NULL, 4);
|
||||||
|
SELECT * FROM t1;
|
||||||
|
c1 c2
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
3 3
|
||||||
|
4 4
|
||||||
|
DROP TABLE t1;
|
||||||
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5;
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
Warnings:
|
||||||
|
Note 1051 Unknown table 't1'
|
||||||
|
DROP TABLE IF EXISTS t2;
|
||||||
|
Warnings:
|
||||||
|
Note 1051 Unknown table 't2'
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
a INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
b INT(10) UNSIGNED NOT NULL,
|
||||||
|
c ENUM('FALSE','TRUE') DEFAULT NULL,
|
||||||
|
PRIMARY KEY (a)) ENGINE = InnoDB;
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
m INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
n INT(10) UNSIGNED NOT NULL,
|
||||||
|
o enum('FALSE','TRUE') DEFAULT NULL,
|
||||||
|
PRIMARY KEY (m)) ENGINE = InnoDB;
|
||||||
|
INSERT INTO t2 (n,o) VALUES
|
||||||
|
(1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'),
|
||||||
|
(3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false');
|
||||||
|
SHOW CREATE TABLE t2;
|
||||||
|
Table Create Table
|
||||||
|
t2 CREATE TABLE `t2` (
|
||||||
|
`m` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`n` int(10) unsigned NOT NULL,
|
||||||
|
`o` enum('FALSE','TRUE') DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`m`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1
|
||||||
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`b` int(10) unsigned NOT NULL,
|
||||||
|
`c` enum('FALSE','TRUE') DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`a`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1
|
||||||
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b c
|
||||||
|
1 1 TRUE
|
||||||
|
2 1 FALSE
|
||||||
|
3 2 TRUE
|
||||||
|
4 2 FALSE
|
||||||
|
5 3 TRUE
|
||||||
|
6 3 FALSE
|
||||||
|
7 4 TRUE
|
||||||
|
8 4 FALSE
|
||||||
|
9 5 TRUE
|
||||||
|
10 5 FALSE
|
||||||
|
13 1 TRUE
|
||||||
|
14 1 FALSE
|
||||||
|
15 2 TRUE
|
||||||
|
16 2 FALSE
|
||||||
|
17 3 TRUE
|
||||||
|
18 3 FALSE
|
||||||
|
19 4 TRUE
|
||||||
|
20 4 FALSE
|
||||||
|
21 5 TRUE
|
||||||
|
22 5 FALSE
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`b` int(10) unsigned NOT NULL,
|
||||||
|
`c` enum('FALSE','TRUE') DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`a`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1
|
||||||
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b c
|
||||||
|
1 1 TRUE
|
||||||
|
2 1 FALSE
|
||||||
|
3 2 TRUE
|
||||||
|
4 2 FALSE
|
||||||
|
5 3 TRUE
|
||||||
|
6 3 FALSE
|
||||||
|
7 4 TRUE
|
||||||
|
8 4 FALSE
|
||||||
|
9 5 TRUE
|
||||||
|
10 5 FALSE
|
||||||
|
13 1 TRUE
|
||||||
|
14 1 FALSE
|
||||||
|
15 2 TRUE
|
||||||
|
16 2 FALSE
|
||||||
|
17 3 TRUE
|
||||||
|
18 3 FALSE
|
||||||
|
19 4 TRUE
|
||||||
|
20 4 FALSE
|
||||||
|
21 5 TRUE
|
||||||
|
22 5 FALSE
|
||||||
|
23 1 FALSE
|
||||||
|
24 2 FALSE
|
||||||
|
25 3 FALSE
|
||||||
|
26 4 FALSE
|
||||||
|
27 5 FALSE
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`b` int(10) unsigned NOT NULL,
|
||||||
|
`c` enum('FALSE','TRUE') DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`a`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=latin1
|
||||||
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b c
|
||||||
|
1 1 TRUE
|
||||||
|
2 1 FALSE
|
||||||
|
3 2 TRUE
|
||||||
|
4 2 FALSE
|
||||||
|
5 3 TRUE
|
||||||
|
6 3 FALSE
|
||||||
|
7 4 TRUE
|
||||||
|
8 4 FALSE
|
||||||
|
9 5 TRUE
|
||||||
|
10 5 FALSE
|
||||||
|
13 1 TRUE
|
||||||
|
14 1 FALSE
|
||||||
|
15 2 TRUE
|
||||||
|
16 2 FALSE
|
||||||
|
17 3 TRUE
|
||||||
|
18 3 FALSE
|
||||||
|
19 4 TRUE
|
||||||
|
20 4 FALSE
|
||||||
|
21 5 TRUE
|
||||||
|
22 5 FALSE
|
||||||
|
23 1 FALSE
|
||||||
|
24 2 FALSE
|
||||||
|
25 3 FALSE
|
||||||
|
26 4 FALSE
|
||||||
|
27 5 FALSE
|
||||||
|
30 1 FALSE
|
||||||
|
31 2 FALSE
|
||||||
|
32 3 FALSE
|
||||||
|
33 4 FALSE
|
||||||
|
34 5 FALSE
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`b` int(10) unsigned NOT NULL,
|
||||||
|
`c` enum('FALSE','TRUE') DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`a`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=latin1
|
||||||
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`b` int(10) unsigned NOT NULL,
|
||||||
|
`c` enum('FALSE','TRUE') DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`a`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=latin1
|
||||||
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`b` int(10) unsigned NOT NULL,
|
||||||
|
`c` enum('FALSE','TRUE') DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`a`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=latin1
|
||||||
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b c
|
||||||
|
1 1 TRUE
|
||||||
|
2 1 FALSE
|
||||||
|
3 2 TRUE
|
||||||
|
4 2 FALSE
|
||||||
|
5 3 TRUE
|
||||||
|
6 3 FALSE
|
||||||
|
7 4 TRUE
|
||||||
|
8 4 FALSE
|
||||||
|
9 5 TRUE
|
||||||
|
10 5 FALSE
|
||||||
|
13 1 TRUE
|
||||||
|
14 1 FALSE
|
||||||
|
15 2 TRUE
|
||||||
|
16 2 FALSE
|
||||||
|
17 3 TRUE
|
||||||
|
18 3 FALSE
|
||||||
|
19 4 TRUE
|
||||||
|
20 4 FALSE
|
||||||
|
21 5 TRUE
|
||||||
|
22 5 FALSE
|
||||||
|
23 1 FALSE
|
||||||
|
24 2 FALSE
|
||||||
|
25 3 FALSE
|
||||||
|
26 4 FALSE
|
||||||
|
27 5 FALSE
|
||||||
|
30 1 FALSE
|
||||||
|
31 2 FALSE
|
||||||
|
32 3 FALSE
|
||||||
|
33 4 FALSE
|
||||||
|
34 5 FALSE
|
||||||
|
37 1 FALSE
|
||||||
|
38 2 FALSE
|
||||||
|
39 3 FALSE
|
||||||
|
40 4 FALSE
|
||||||
|
41 5 FALSE
|
||||||
|
44 1 FALSE
|
||||||
|
45 2 FALSE
|
||||||
|
46 3 FALSE
|
||||||
|
47 4 FALSE
|
||||||
|
48 5 FALSE
|
||||||
|
51 1 FALSE
|
||||||
|
52 2 FALSE
|
||||||
|
53 3 FALSE
|
||||||
|
54 4 FALSE
|
||||||
|
55 5 FALSE
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`b` int(10) unsigned NOT NULL,
|
||||||
|
`c` enum('FALSE','TRUE') DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`a`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=58 DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP TABLE t2;
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
Warnings:
|
||||||
|
Note 1051 Unknown table 't1'
|
||||||
|
DROP TABLE IF EXISTS t2;
|
||||||
|
Warnings:
|
||||||
|
Note 1051 Unknown table 't2'
|
||||||
|
CREATE TABLE t1(
|
||||||
|
c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT
|
||||||
|
PRIMARY KEY) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
|
||||||
|
CREATE TABLE t2(
|
||||||
|
c1 TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT
|
||||||
|
PRIMARY KEY) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t2 SELECT c1 FROM t1;
|
||||||
|
Got one of the listed errors
|
||||||
|
INSERT INTO t2 SELECT NULL FROM t1;
|
||||||
|
Got one of the listed errors
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP TABLE t2;
|
||||||
|
@ -56,7 +56,7 @@ general_log CREATE TABLE `general_log` (
|
|||||||
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
`user_host` mediumtext NOT NULL,
|
`user_host` mediumtext NOT NULL,
|
||||||
`thread_id` int(11) NOT NULL,
|
`thread_id` int(11) NOT NULL,
|
||||||
`server_id` int(11) NOT NULL,
|
`server_id` int(10) unsigned NOT NULL,
|
||||||
`command_type` varchar(64) NOT NULL,
|
`command_type` varchar(64) NOT NULL,
|
||||||
`argument` mediumtext NOT NULL
|
`argument` mediumtext NOT NULL
|
||||||
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
|
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
|
||||||
@ -65,7 +65,7 @@ Field Type Null Key Default Extra
|
|||||||
event_time timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
|
event_time timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
|
||||||
user_host mediumtext NO NULL
|
user_host mediumtext NO NULL
|
||||||
thread_id int(11) NO NULL
|
thread_id int(11) NO NULL
|
||||||
server_id int(11) NO NULL
|
server_id int(10) unsigned NO NULL
|
||||||
command_type varchar(64) NO NULL
|
command_type varchar(64) NO NULL
|
||||||
argument mediumtext NO NULL
|
argument mediumtext NO NULL
|
||||||
show create table mysql.slow_log;
|
show create table mysql.slow_log;
|
||||||
@ -80,7 +80,7 @@ slow_log CREATE TABLE `slow_log` (
|
|||||||
`db` varchar(512) NOT NULL,
|
`db` varchar(512) NOT NULL,
|
||||||
`last_insert_id` int(11) NOT NULL,
|
`last_insert_id` int(11) NOT NULL,
|
||||||
`insert_id` int(11) NOT NULL,
|
`insert_id` int(11) NOT NULL,
|
||||||
`server_id` int(11) NOT NULL,
|
`server_id` int(10) unsigned NOT NULL,
|
||||||
`sql_text` mediumtext NOT NULL
|
`sql_text` mediumtext NOT NULL
|
||||||
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
|
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
|
||||||
show fields from mysql.slow_log;
|
show fields from mysql.slow_log;
|
||||||
@ -94,7 +94,7 @@ rows_examined int(11) NO NULL
|
|||||||
db varchar(512) NO NULL
|
db varchar(512) NO NULL
|
||||||
last_insert_id int(11) NO NULL
|
last_insert_id int(11) NO NULL
|
||||||
insert_id int(11) NO NULL
|
insert_id int(11) NO NULL
|
||||||
server_id int(11) NO NULL
|
server_id int(10) unsigned NO NULL
|
||||||
sql_text mediumtext NO NULL
|
sql_text mediumtext NO NULL
|
||||||
flush logs;
|
flush logs;
|
||||||
flush tables;
|
flush tables;
|
||||||
@ -167,7 +167,7 @@ general_log CREATE TABLE `general_log` (
|
|||||||
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
`user_host` mediumtext NOT NULL,
|
`user_host` mediumtext NOT NULL,
|
||||||
`thread_id` int(11) NOT NULL,
|
`thread_id` int(11) NOT NULL,
|
||||||
`server_id` int(11) NOT NULL,
|
`server_id` int(10) unsigned NOT NULL,
|
||||||
`command_type` varchar(64) NOT NULL,
|
`command_type` varchar(64) NOT NULL,
|
||||||
`argument` mediumtext NOT NULL
|
`argument` mediumtext NOT NULL
|
||||||
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
|
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
|
||||||
@ -183,7 +183,7 @@ slow_log CREATE TABLE `slow_log` (
|
|||||||
`db` varchar(512) NOT NULL,
|
`db` varchar(512) NOT NULL,
|
||||||
`last_insert_id` int(11) NOT NULL,
|
`last_insert_id` int(11) NOT NULL,
|
||||||
`insert_id` int(11) NOT NULL,
|
`insert_id` int(11) NOT NULL,
|
||||||
`server_id` int(11) NOT NULL,
|
`server_id` int(10) unsigned NOT NULL,
|
||||||
`sql_text` mediumtext NOT NULL
|
`sql_text` mediumtext NOT NULL
|
||||||
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
|
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
|
||||||
alter table mysql.general_log engine=myisam;
|
alter table mysql.general_log engine=myisam;
|
||||||
@ -194,7 +194,7 @@ general_log CREATE TABLE `general_log` (
|
|||||||
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
`user_host` mediumtext NOT NULL,
|
`user_host` mediumtext NOT NULL,
|
||||||
`thread_id` int(11) NOT NULL,
|
`thread_id` int(11) NOT NULL,
|
||||||
`server_id` int(11) NOT NULL,
|
`server_id` int(10) unsigned NOT NULL,
|
||||||
`command_type` varchar(64) NOT NULL,
|
`command_type` varchar(64) NOT NULL,
|
||||||
`argument` mediumtext NOT NULL
|
`argument` mediumtext NOT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='General log'
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='General log'
|
||||||
@ -210,7 +210,7 @@ slow_log CREATE TABLE `slow_log` (
|
|||||||
`db` varchar(512) NOT NULL,
|
`db` varchar(512) NOT NULL,
|
||||||
`last_insert_id` int(11) NOT NULL,
|
`last_insert_id` int(11) NOT NULL,
|
||||||
`insert_id` int(11) NOT NULL,
|
`insert_id` int(11) NOT NULL,
|
||||||
`server_id` int(11) NOT NULL,
|
`server_id` int(10) unsigned NOT NULL,
|
||||||
`sql_text` mediumtext NOT NULL
|
`sql_text` mediumtext NOT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Slow log'
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Slow log'
|
||||||
set global general_log='ON';
|
set global general_log='ON';
|
||||||
@ -268,7 +268,7 @@ CREATE TABLE `general_log` (
|
|||||||
ON UPDATE CURRENT_TIMESTAMP,
|
ON UPDATE CURRENT_TIMESTAMP,
|
||||||
`user_host` mediumtext NOT NULL,
|
`user_host` mediumtext NOT NULL,
|
||||||
`thread_id` int(11) NOT NULL,
|
`thread_id` int(11) NOT NULL,
|
||||||
`server_id` int(11) NOT NULL,
|
`server_id` int(10) unsigned NOT NULL,
|
||||||
`command_type` varchar(64) NOT NULL,
|
`command_type` varchar(64) NOT NULL,
|
||||||
`argument` mediumtext NOT NULL
|
`argument` mediumtext NOT NULL
|
||||||
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
|
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
|
||||||
@ -283,7 +283,7 @@ ON UPDATE CURRENT_TIMESTAMP,
|
|||||||
`db` varchar(512) NOT NULL,
|
`db` varchar(512) NOT NULL,
|
||||||
`last_insert_id` int(11) NOT NULL,
|
`last_insert_id` int(11) NOT NULL,
|
||||||
`insert_id` int(11) NOT NULL,
|
`insert_id` int(11) NOT NULL,
|
||||||
`server_id` int(11) NOT NULL,
|
`server_id` int(10) unsigned NOT NULL,
|
||||||
`sql_text` mediumtext NOT NULL
|
`sql_text` mediumtext NOT NULL
|
||||||
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
|
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
|
||||||
set global general_log='ON';
|
set global general_log='ON';
|
||||||
|
@ -227,7 +227,7 @@ event CREATE TABLE `event` (
|
|||||||
`on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
|
`on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
|
||||||
`sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
|
`sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
|
||||||
`comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
`comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||||
`originator` int(10) NOT NULL,
|
`originator` int(10) unsigned NOT NULL,
|
||||||
`time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
|
`time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
|
||||||
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||||
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||||
@ -241,7 +241,7 @@ general_log CREATE TABLE `general_log` (
|
|||||||
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
`user_host` mediumtext NOT NULL,
|
`user_host` mediumtext NOT NULL,
|
||||||
`thread_id` int(11) NOT NULL,
|
`thread_id` int(11) NOT NULL,
|
||||||
`server_id` int(11) NOT NULL,
|
`server_id` int(10) unsigned NOT NULL,
|
||||||
`command_type` varchar(64) NOT NULL,
|
`command_type` varchar(64) NOT NULL,
|
||||||
`argument` mediumtext NOT NULL
|
`argument` mediumtext NOT NULL
|
||||||
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
|
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
|
||||||
@ -257,7 +257,7 @@ slow_log CREATE TABLE `slow_log` (
|
|||||||
`db` varchar(512) NOT NULL,
|
`db` varchar(512) NOT NULL,
|
||||||
`last_insert_id` int(11) NOT NULL,
|
`last_insert_id` int(11) NOT NULL,
|
||||||
`insert_id` int(11) NOT NULL,
|
`insert_id` int(11) NOT NULL,
|
||||||
`server_id` int(11) NOT NULL,
|
`server_id` int(10) unsigned NOT NULL,
|
||||||
`sql_text` mediumtext NOT NULL
|
`sql_text` mediumtext NOT NULL
|
||||||
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
|
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
|
||||||
show tables;
|
show tables;
|
||||||
|
@ -1426,4 +1426,32 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
|
|||||||
def @@storage_engine 253 6 6 N 1 31 8
|
def @@storage_engine 253 6 6 N 1 31 8
|
||||||
@@storage_engine
|
@@storage_engine
|
||||||
MyISAM
|
MyISAM
|
||||||
|
SET @old_server_id = @@GLOBAL.server_id;
|
||||||
|
SET GLOBAL server_id = (1 << 32) - 1;
|
||||||
|
SELECT @@GLOBAL.server_id;
|
||||||
|
@@GLOBAL.server_id
|
||||||
|
4294967295
|
||||||
|
SET GLOBAL server_id = (1 << 32);
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect server-id value: '4294967296'
|
||||||
|
SELECT @@GLOBAL.server_id;
|
||||||
|
@@GLOBAL.server_id
|
||||||
|
4294967295
|
||||||
|
SET GLOBAL server_id = (1 << 60);
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect server-id value: '1152921504606846976'
|
||||||
|
SELECT @@GLOBAL.server_id;
|
||||||
|
@@GLOBAL.server_id
|
||||||
|
4294967295
|
||||||
|
SET GLOBAL server_id = 0;
|
||||||
|
SELECT @@GLOBAL.server_id;
|
||||||
|
@@GLOBAL.server_id
|
||||||
|
0
|
||||||
|
SET GLOBAL server_id = -1;
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect server_id value: '-1'
|
||||||
|
SELECT @@GLOBAL.server_id;
|
||||||
|
@@GLOBAL.server_id
|
||||||
|
0
|
||||||
|
SET GLOBAL server_id = @old_server_id;
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
|
@ -60,9 +60,11 @@ SELECT @@global.server_id;
|
|||||||
@@global.server_id
|
@@global.server_id
|
||||||
0
|
0
|
||||||
SET @@global.server_id = 2147483649*2;
|
SET @@global.server_id = 2147483649*2;
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect server-id value: '4294967298'
|
||||||
SELECT @@global.server_id;
|
SELECT @@global.server_id;
|
||||||
@@global.server_id
|
@@global.server_id
|
||||||
4294967298
|
4294967295
|
||||||
SET @@global.server_id = 65530.34.;
|
SET @@global.server_id = 65530.34.;
|
||||||
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
|
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
|
||||||
SET @@global.server_id = '125';
|
SET @@global.server_id = '125';
|
||||||
|
@ -1209,6 +1209,18 @@ select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mo
|
|||||||
select name from mysql.event where name = 'p' and sql_mode = @full_mode;
|
select name from mysql.event where name = 'p' and sql_mode = @full_mode;
|
||||||
drop event e1;
|
drop event e1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id
|
||||||
|
#
|
||||||
|
|
||||||
|
SET @old_server_id = @@GLOBAL.server_id;
|
||||||
|
SET GLOBAL server_id = (1 << 32) - 1;
|
||||||
|
SELECT @@GLOBAL.server_id;
|
||||||
|
CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
|
||||||
|
SELECT event_name, originator FROM INFORMATION_SCHEMA.EVENTS;
|
||||||
|
DROP EVENT ev1;
|
||||||
|
SET GLOBAL server_id = @old_server_id;
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
#
|
#
|
||||||
# End of tests
|
# End of tests
|
||||||
|
@ -123,6 +123,21 @@ execute s1;
|
|||||||
|
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #43354: Use key hint can crash server in explain extended query
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||||
|
|
||||||
|
--error ER_KEY_DOES_NOT_EXITS
|
||||||
|
EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a);
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
|
# End of 5.0 tests.
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # Bug#37870: Usage of uninitialized value caused failed assertion.
|
--echo # Bug#37870: Usage of uninitialized value caused failed assertion.
|
||||||
--echo #
|
--echo #
|
||||||
@ -141,4 +156,4 @@ flush tables;
|
|||||||
SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' );
|
SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' );
|
||||||
drop tables t1, t2;
|
drop tables t1, t2;
|
||||||
|
|
||||||
# End of 5.0 tests.
|
--echo End of 5.1 tests.
|
||||||
|
@ -390,3 +390,91 @@ INSERT INTO t1 VALUES (NULL);
|
|||||||
#endif
|
#endif
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check for floating point autoinc column handling
|
||||||
|
#
|
||||||
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||||
|
SET @@INSERT_ID=1;
|
||||||
|
SHOW VARIABLES LIKE "%auto_inc%";
|
||||||
|
CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES(NULL, 1);
|
||||||
|
INSERT INTO t1 VALUES(NULL, 2);
|
||||||
|
SELECT * FROM t1;
|
||||||
|
ALTER TABLE t1 CHANGE c1 c1 SERIAL;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
INSERT INTO t1 VALUES(NULL, 3);
|
||||||
|
INSERT INTO t1 VALUES(NULL, 4);
|
||||||
|
SELECT * FROM t1;
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
CREATE TABLE t1 (c1 FLOAT NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES(NULL, 1);
|
||||||
|
INSERT INTO t1 VALUES(NULL, 2);
|
||||||
|
SELECT * FROM t1;
|
||||||
|
ALTER TABLE t1 CHANGE c1 c1 SERIAL;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
INSERT INTO t1 VALUES(NULL, 3);
|
||||||
|
INSERT INTO t1 VALUES(NULL, 4);
|
||||||
|
SELECT * FROM t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug# 42714: AUTOINC column calculated next value not greater than highest
|
||||||
|
# value stored in table.
|
||||||
|
#
|
||||||
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5;
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
DROP TABLE IF EXISTS t2;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
a INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
b INT(10) UNSIGNED NOT NULL,
|
||||||
|
c ENUM('FALSE','TRUE') DEFAULT NULL,
|
||||||
|
PRIMARY KEY (a)) ENGINE = InnoDB;
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
m INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
n INT(10) UNSIGNED NOT NULL,
|
||||||
|
o enum('FALSE','TRUE') DEFAULT NULL,
|
||||||
|
PRIMARY KEY (m)) ENGINE = InnoDB;
|
||||||
|
INSERT INTO t2 (n,o) VALUES
|
||||||
|
(1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'),
|
||||||
|
(3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false');
|
||||||
|
SHOW CREATE TABLE t2;
|
||||||
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||||
|
SELECT * FROM t1;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||||
|
SELECT * FROM t1;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||||
|
SELECT * FROM t1;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP TABLE t2;
|
||||||
|
#
|
||||||
|
# 43203: Overflow from auto incrementing causes server segv
|
||||||
|
#
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
DROP TABLE IF EXISTS t2;
|
||||||
|
CREATE TABLE t1(
|
||||||
|
c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT
|
||||||
|
PRIMARY KEY) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
|
||||||
|
CREATE TABLE t2(
|
||||||
|
c1 TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT
|
||||||
|
PRIMARY KEY) ENGINE=InnoDB;
|
||||||
|
-- error ER_DUP_ENTRY,1062
|
||||||
|
INSERT INTO t2 SELECT c1 FROM t1;
|
||||||
|
-- error ER_DUP_ENTRY,1467
|
||||||
|
INSERT INTO t2 SELECT NULL FROM t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP TABLE t2;
|
||||||
|
@ -287,7 +287,7 @@ CREATE TABLE `general_log` (
|
|||||||
ON UPDATE CURRENT_TIMESTAMP,
|
ON UPDATE CURRENT_TIMESTAMP,
|
||||||
`user_host` mediumtext NOT NULL,
|
`user_host` mediumtext NOT NULL,
|
||||||
`thread_id` int(11) NOT NULL,
|
`thread_id` int(11) NOT NULL,
|
||||||
`server_id` int(11) NOT NULL,
|
`server_id` int(10) unsigned NOT NULL,
|
||||||
`command_type` varchar(64) NOT NULL,
|
`command_type` varchar(64) NOT NULL,
|
||||||
`argument` mediumtext NOT NULL
|
`argument` mediumtext NOT NULL
|
||||||
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
|
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
|
||||||
@ -303,7 +303,7 @@ CREATE TABLE `slow_log` (
|
|||||||
`db` varchar(512) NOT NULL,
|
`db` varchar(512) NOT NULL,
|
||||||
`last_insert_id` int(11) NOT NULL,
|
`last_insert_id` int(11) NOT NULL,
|
||||||
`insert_id` int(11) NOT NULL,
|
`insert_id` int(11) NOT NULL,
|
||||||
`server_id` int(11) NOT NULL,
|
`server_id` int(10) unsigned NOT NULL,
|
||||||
`sql_text` mediumtext NOT NULL
|
`sql_text` mediumtext NOT NULL
|
||||||
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
|
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@ drop table t1;
|
|||||||
create table t1 (a bit) engine=innodb;
|
create table t1 (a bit) engine=innodb;
|
||||||
insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
|
insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
|
||||||
select hex(a) from t1;
|
select hex(a) from t1;
|
||||||
|
# It is not deterministic which duplicate will be seen first
|
||||||
|
--replace_regex /(.*Duplicate entry )'.*'( for key.*)/\1''\2/
|
||||||
--error ER_DUP_ENTRY
|
--error ER_DUP_ENTRY
|
||||||
alter table t1 add unique (a);
|
alter table t1 add unique (a);
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -1164,5 +1164,21 @@ SET GLOBAL expire_logs_days = @old_eld;
|
|||||||
select @@storage_engine;
|
select @@storage_engine;
|
||||||
--disable_metadata
|
--disable_metadata
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id
|
||||||
|
#
|
||||||
|
|
||||||
|
SET @old_server_id = @@GLOBAL.server_id;
|
||||||
|
SET GLOBAL server_id = (1 << 32) - 1;
|
||||||
|
SELECT @@GLOBAL.server_id;
|
||||||
|
SET GLOBAL server_id = (1 << 32);
|
||||||
|
SELECT @@GLOBAL.server_id;
|
||||||
|
SET GLOBAL server_id = (1 << 60);
|
||||||
|
SELECT @@GLOBAL.server_id;
|
||||||
|
SET GLOBAL server_id = 0;
|
||||||
|
SELECT @@GLOBAL.server_id;
|
||||||
|
SET GLOBAL server_id = -1;
|
||||||
|
SELECT @@GLOBAL.server_id;
|
||||||
|
SET GLOBAL server_id = @old_server_id;
|
||||||
|
|
||||||
--echo End of 5.1 tests
|
--echo End of 5.1 tests
|
||||||
|
581
mysys/md5.c
581
mysys/md5.c
@ -13,356 +13,313 @@
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
||||||
/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
|
/*
|
||||||
|
* This code implements the MD5 message-digest algorithm.
|
||||||
|
* The algorithm is due to Ron Rivest. This code was
|
||||||
|
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||||
|
* This code is in the public domain; do with it what you wish.
|
||||||
|
*
|
||||||
|
* Equivalent code is available from RSA Data Security, Inc.
|
||||||
|
* This code has been tested against that, and is equivalent,
|
||||||
|
* except that you don't need to include two pages of legalese
|
||||||
|
* with every copy.
|
||||||
|
*
|
||||||
|
* To compute the message digest of a chunk of bytes, declare an
|
||||||
|
* MD5Context structure, pass it to MD5Init, call MD5Update as
|
||||||
|
* needed on buffers full of bytes, and then call MD5Final, which
|
||||||
|
* will fill a supplied 16-byte array with the digest.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
/* This code was modified in 1997 by Jim Kingdon of Cyclic Software to
|
||||||
rights reserved.
|
not require an integer type which is exactly 32 bits. This work
|
||||||
|
draws on the changes for the same purpose by Tatu Ylonen
|
||||||
License to copy and use this software is granted provided that it
|
<ylo@cs.hut.fi> as part of SSH, but since I didn't actually use
|
||||||
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
|
that code, there is no copyright issue. I hereby disclaim
|
||||||
Algorithm" in all material mentioning or referencing this software
|
copyright in any changes I have made; this code remains in the
|
||||||
or this function.
|
public domain. */
|
||||||
|
|
||||||
License is also granted to make and use derivative works provided
|
|
||||||
that such works are identified as "derived from the RSA Data
|
|
||||||
Security, Inc. MD5 Message-Digest Algorithm" in all material
|
|
||||||
mentioning or referencing the derived work.
|
|
||||||
|
|
||||||
RSA Data Security, Inc. makes no representations concerning either
|
|
||||||
the merchantability of this software or the suitability of this
|
|
||||||
software for any particular purpose. It is provided "as is"
|
|
||||||
without express or implied warranty of any kind.
|
|
||||||
|
|
||||||
These notices must be retained in any copies of any part of this
|
|
||||||
documentation and/or software.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Changes by Monty:
|
|
||||||
Replace of MD5_memset and MD5_memcpy with memset & memcpy
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
#include "my_md5.h"
|
#include "my_md5.h"
|
||||||
|
|
||||||
/* Constants for MD5Transform routine. */
|
#include <string.h> /* for memcpy() and memset() */
|
||||||
|
|
||||||
#define S11 7
|
|
||||||
#define S12 12
|
|
||||||
#define S13 17
|
|
||||||
#define S14 22
|
|
||||||
#define S21 5
|
|
||||||
#define S22 9
|
|
||||||
#define S23 14
|
|
||||||
#define S24 20
|
|
||||||
#define S31 4
|
|
||||||
#define S32 11
|
|
||||||
#define S33 16
|
|
||||||
#define S34 23
|
|
||||||
#define S41 6
|
|
||||||
#define S42 10
|
|
||||||
#define S43 15
|
|
||||||
#define S44 21
|
|
||||||
|
|
||||||
|
|
||||||
static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
|
static void
|
||||||
static void Encode PROTO_LIST
|
my_MD5Transform (cvs_uint32 buf[4], const unsigned char in[64]);
|
||||||
((unsigned char *, UINT4 *, unsigned int));
|
|
||||||
static void Decode PROTO_LIST
|
|
||||||
((UINT4 *, unsigned char *, unsigned int));
|
|
||||||
#ifdef OLD_CODE
|
|
||||||
static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
|
|
||||||
static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
|
|
||||||
#else
|
|
||||||
#define MD5_memcpy(A,B,C) memcpy((char*) (A),(char*) (B), (C))
|
|
||||||
#define MD5_memset(A,B,C) memset((char*) (A),(B), (C))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static unsigned char PADDING[64] = {
|
/* Little-endian byte-swapping routines. Note that these do not
|
||||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
depend on the size of datatypes such as uint32, nor do they require
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
us to detect the endianness of the machine we are running on. It
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
is possible they should be macros for speed, but I would be
|
||||||
};
|
surprised if they were a performance bottleneck for MD5. */
|
||||||
|
|
||||||
/* F, G, H and I are basic MD5 functions.
|
static uint32 getu32 (const unsigned char *addr)
|
||||||
*/
|
|
||||||
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
|
|
||||||
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
|
|
||||||
#define H(x, y, z) ((x) ^ (y) ^ (z))
|
|
||||||
#define I(x, y, z) ((y) ^ ((x) | (~z)))
|
|
||||||
|
|
||||||
/* ROTATE_LEFT rotates x left n bits.
|
|
||||||
*/
|
|
||||||
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
|
|
||||||
|
|
||||||
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
|
|
||||||
Rotation is separate from addition to prevent recomputation.
|
|
||||||
*/
|
|
||||||
#define FF(a, b, c, d, x, s, ac) { \
|
|
||||||
(a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
|
|
||||||
(a) = ROTATE_LEFT ((a), (s)); \
|
|
||||||
(a) += (b); \
|
|
||||||
}
|
|
||||||
#define GG(a, b, c, d, x, s, ac) { \
|
|
||||||
(a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
|
|
||||||
(a) = ROTATE_LEFT ((a), (s)); \
|
|
||||||
(a) += (b); \
|
|
||||||
}
|
|
||||||
#define HH(a, b, c, d, x, s, ac) { \
|
|
||||||
(a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
|
|
||||||
(a) = ROTATE_LEFT ((a), (s)); \
|
|
||||||
(a) += (b); \
|
|
||||||
}
|
|
||||||
#define II(a, b, c, d, x, s, ac) { \
|
|
||||||
(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
|
|
||||||
(a) = ROTATE_LEFT ((a), (s)); \
|
|
||||||
(a) += (b); \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* MD5 initialization. Begins an MD5 operation, writing a new context.
|
|
||||||
*/
|
|
||||||
void my_MD5Init (my_MD5_CTX *context) /* context */
|
|
||||||
{
|
{
|
||||||
context->count[0] = context->count[1] = 0;
|
return (((((unsigned long)addr[3] << 8) | addr[2]) << 8)
|
||||||
/* Load magic initialization constants.
|
| addr[1]) << 8 | addr[0];
|
||||||
*/
|
|
||||||
context->state[0] = 0x67452301;
|
|
||||||
context->state[1] = 0xefcdab89;
|
|
||||||
context->state[2] = 0x98badcfe;
|
|
||||||
context->state[3] = 0x10325476;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MD5 block update operation. Continues an MD5 message-digest
|
static void
|
||||||
operation, processing another message block, and updating the
|
putu32 (uint32 data, unsigned char *addr)
|
||||||
context.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void my_MD5Update (
|
|
||||||
my_MD5_CTX *context, /* context */
|
|
||||||
unsigned char *input, /* input block */
|
|
||||||
unsigned int inputLen) /* length of input block */
|
|
||||||
{
|
{
|
||||||
unsigned int i, idx, partLen;
|
addr[0] = (unsigned char)data;
|
||||||
|
addr[1] = (unsigned char)(data >> 8);
|
||||||
|
addr[2] = (unsigned char)(data >> 16);
|
||||||
|
addr[3] = (unsigned char)(data >> 24);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
||||||
|
initialization constants.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
my_MD5Init (my_MD5Context *ctx)
|
||||||
|
{
|
||||||
|
ctx->buf[0] = 0x67452301;
|
||||||
|
ctx->buf[1] = 0xefcdab89;
|
||||||
|
ctx->buf[2] = 0x98badcfe;
|
||||||
|
ctx->buf[3] = 0x10325476;
|
||||||
|
|
||||||
|
ctx->bits[0] = 0;
|
||||||
|
ctx->bits[1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Update context to reflect the concatenation of another buffer full
|
||||||
|
of bytes.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
my_MD5Update (my_MD5Context *ctx, unsigned char const *buf, unsigned len)
|
||||||
|
{
|
||||||
|
uint32 t;
|
||||||
|
|
||||||
|
/* Update bitcount */
|
||||||
|
|
||||||
|
t = ctx->bits[0];
|
||||||
|
if ((ctx->bits[0] = (t + ((uint32)len << 3)) & 0xffffffff) < t)
|
||||||
|
ctx->bits[1]++; /* Carry from low to high */
|
||||||
|
ctx->bits[1] += len >> 29;
|
||||||
|
|
||||||
|
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
|
||||||
|
|
||||||
|
/* Handle any leading odd-sized chunks */
|
||||||
|
|
||||||
|
if ( t ) {
|
||||||
|
unsigned char *p = ctx->in + t;
|
||||||
|
|
||||||
|
t = 64-t;
|
||||||
|
if (len < t) {
|
||||||
|
memcpy(p, buf, len);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memcpy(p, buf, t);
|
||||||
|
my_MD5Transform (ctx->buf, ctx->in);
|
||||||
|
buf += t;
|
||||||
|
len -= t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Process data in 64-byte chunks */
|
||||||
|
|
||||||
|
while (len >= 64) {
|
||||||
|
memcpy(ctx->in, buf, 64);
|
||||||
|
my_MD5Transform (ctx->buf, ctx->in);
|
||||||
|
buf += 64;
|
||||||
|
len -= 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Handle any remaining bytes of data. */
|
||||||
|
|
||||||
|
memcpy(ctx->in, buf, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Final wrapup - pad to 64-byte boundary with the bit pattern
|
||||||
|
1 0* (64-bit count of bits processed, MSB-first)
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
my_MD5Final (unsigned char digest[16], my_MD5Context *ctx)
|
||||||
|
{
|
||||||
|
unsigned count;
|
||||||
|
unsigned char *p;
|
||||||
|
|
||||||
/* Compute number of bytes mod 64 */
|
/* Compute number of bytes mod 64 */
|
||||||
idx = (unsigned int)((context->count[0] >> 3) & 0x3F);
|
count = (ctx->bits[0] >> 3) & 0x3F;
|
||||||
|
|
||||||
|
/* Set the first char of padding to 0x80. This is safe since there is
|
||||||
|
always at least one byte free */
|
||||||
|
p = ctx->in + count;
|
||||||
|
*p++ = 0x80;
|
||||||
|
|
||||||
/* Update number of bits */
|
/* Bytes of padding needed to make 64 bytes */
|
||||||
if ((context->count[0] += ((UINT4)inputLen << 3))
|
count = 64 - 1 - count;
|
||||||
< ((UINT4)inputLen << 3))
|
|
||||||
context->count[1]++;
|
|
||||||
context->count[1] += ((UINT4)inputLen >> 29);
|
|
||||||
|
|
||||||
partLen = 64 - idx;
|
/* Pad out to 56 mod 64 */
|
||||||
|
if (count < 8) {
|
||||||
|
/* Two lots of padding: Pad the first block to 64 bytes */
|
||||||
|
memset(p, 0, count);
|
||||||
|
my_MD5Transform (ctx->buf, ctx->in);
|
||||||
|
|
||||||
/* Transform as many times as possible.
|
/* Now fill the next block with 56 bytes */
|
||||||
*/
|
memset(ctx->in, 0, 56);
|
||||||
if (inputLen >= partLen) {
|
} else {
|
||||||
MD5_memcpy((POINTER)&context->buffer[idx], (POINTER)input, partLen);
|
/* Pad block to 56 bytes */
|
||||||
MD5Transform(context->state, context->buffer);
|
memset(p, 0, count-8);
|
||||||
|
|
||||||
for (i = partLen; i + 63 < inputLen; i += 64)
|
|
||||||
MD5Transform (context->state, &input[i]);
|
|
||||||
|
|
||||||
idx = 0;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
/* Buffer remaining input */
|
/* Append length in bits and transform */
|
||||||
MD5_memcpy((POINTER)&context->buffer[idx], (POINTER)&input[i],
|
putu32(ctx->bits[0], ctx->in + 56);
|
||||||
inputLen-i);
|
putu32(ctx->bits[1], ctx->in + 60);
|
||||||
|
|
||||||
|
my_MD5Transform (ctx->buf, ctx->in);
|
||||||
|
putu32(ctx->buf[0], digest);
|
||||||
|
putu32(ctx->buf[1], digest + 4);
|
||||||
|
putu32(ctx->buf[2], digest + 8);
|
||||||
|
putu32(ctx->buf[3], digest + 12);
|
||||||
|
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MD5 finalization. Ends an MD5 message-digest operation, writing the
|
#ifndef ASM_MD5
|
||||||
the message digest and zeroizing the context.
|
|
||||||
|
/* The four core functions - F1 is optimized somewhat */
|
||||||
|
|
||||||
|
/* #define F1(x, y, z) (x & y | ~x & z) */
|
||||||
|
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
||||||
|
#define F2(x, y, z) F1(z, x, y)
|
||||||
|
#define F3(x, y, z) (x ^ y ^ z)
|
||||||
|
#define F4(x, y, z) (y ^ (x | ~z))
|
||||||
|
|
||||||
|
/* This is the central step in the MD5 algorithm. */
|
||||||
|
#define MD5STEP(f, w, x, y, z, data, s) \
|
||||||
|
( w += f(x, y, z) + data, w &= 0xffffffff, w = w<<s | w>>(32-s), w += x )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
||||||
|
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||||
|
* the data and converts bytes into longwords for this routine.
|
||||||
*/
|
*/
|
||||||
|
static void
|
||||||
void my_MD5Final (
|
my_MD5Transform (uint32 buf[4], const unsigned char inraw[64])
|
||||||
unsigned char digest[16], /* message digest */
|
|
||||||
my_MD5_CTX *context) /* context */
|
|
||||||
{
|
{
|
||||||
unsigned char bits[8];
|
register uint32 a, b, c, d;
|
||||||
unsigned int idx, padLen;
|
uint32 in[16];
|
||||||
|
int i;
|
||||||
|
|
||||||
/* Save number of bits */
|
for (i = 0; i < 16; ++i)
|
||||||
Encode (bits, context->count, 8);
|
in[i] = getu32 (inraw + 4 * i);
|
||||||
|
|
||||||
/* Pad out to 56 mod 64.
|
a = buf[0];
|
||||||
*/
|
b = buf[1];
|
||||||
idx = (unsigned int)((context->count[0] >> 3) & 0x3f);
|
c = buf[2];
|
||||||
padLen = (idx < 56) ? (56 - idx) : (120 - idx);
|
d = buf[3];
|
||||||
my_MD5Update (context, PADDING, padLen);
|
|
||||||
|
|
||||||
/* Append length (before padding) */
|
MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478, 7);
|
||||||
my_MD5Update (context, bits, 8);
|
MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12);
|
||||||
|
MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17);
|
||||||
|
MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22);
|
||||||
|
MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf, 7);
|
||||||
|
MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12);
|
||||||
|
MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17);
|
||||||
|
MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22);
|
||||||
|
MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8, 7);
|
||||||
|
MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12);
|
||||||
|
MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17);
|
||||||
|
MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22);
|
||||||
|
MD5STEP(F1, a, b, c, d, in[12]+0x6b901122, 7);
|
||||||
|
MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12);
|
||||||
|
MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17);
|
||||||
|
MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22);
|
||||||
|
|
||||||
/* Store state in digest */
|
MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562, 5);
|
||||||
Encode (digest, context->state, 16);
|
MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340, 9);
|
||||||
|
MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14);
|
||||||
|
MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20);
|
||||||
|
MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d, 5);
|
||||||
|
MD5STEP(F2, d, a, b, c, in[10]+0x02441453, 9);
|
||||||
|
MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14);
|
||||||
|
MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20);
|
||||||
|
MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6, 5);
|
||||||
|
MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6, 9);
|
||||||
|
MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14);
|
||||||
|
MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20);
|
||||||
|
MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905, 5);
|
||||||
|
MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8, 9);
|
||||||
|
MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14);
|
||||||
|
MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20);
|
||||||
|
|
||||||
/* Zeroize sensitive information.
|
MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942, 4);
|
||||||
*/
|
MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11);
|
||||||
MD5_memset ((POINTER)context, 0, sizeof (*context));
|
MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16);
|
||||||
}
|
MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23);
|
||||||
|
MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44, 4);
|
||||||
|
MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11);
|
||||||
|
MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16);
|
||||||
|
MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23);
|
||||||
|
MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6, 4);
|
||||||
|
MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11);
|
||||||
|
MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16);
|
||||||
|
MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23);
|
||||||
|
MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039, 4);
|
||||||
|
MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11);
|
||||||
|
MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16);
|
||||||
|
MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23);
|
||||||
|
|
||||||
/* MD5 basic transformation. Transforms state based on block.
|
MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244, 6);
|
||||||
*/
|
MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10);
|
||||||
static void MD5Transform (
|
MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15);
|
||||||
UINT4 state[4],
|
MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21);
|
||||||
unsigned char block[64])
|
MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3, 6);
|
||||||
{
|
MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10);
|
||||||
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
|
MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15);
|
||||||
|
MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21);
|
||||||
|
MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f, 6);
|
||||||
|
MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10);
|
||||||
|
MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15);
|
||||||
|
MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21);
|
||||||
|
MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82, 6);
|
||||||
|
MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10);
|
||||||
|
MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15);
|
||||||
|
MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21);
|
||||||
|
|
||||||
Decode (x, block, 64);
|
buf[0] += a;
|
||||||
|
buf[1] += b;
|
||||||
/* Round 1 */
|
buf[2] += c;
|
||||||
FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
|
buf[3] += d;
|
||||||
FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
|
|
||||||
FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
|
|
||||||
FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
|
|
||||||
FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
|
|
||||||
FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
|
|
||||||
FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
|
|
||||||
FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
|
|
||||||
FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
|
|
||||||
FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
|
|
||||||
FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
|
|
||||||
FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
|
|
||||||
FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
|
|
||||||
FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
|
|
||||||
FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
|
|
||||||
FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
|
|
||||||
|
|
||||||
/* Round 2 */
|
|
||||||
GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
|
|
||||||
GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
|
|
||||||
GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
|
|
||||||
GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
|
|
||||||
GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
|
|
||||||
GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
|
|
||||||
GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
|
|
||||||
GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
|
|
||||||
GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
|
|
||||||
GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
|
|
||||||
GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
|
|
||||||
GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
|
|
||||||
GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
|
|
||||||
GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
|
|
||||||
GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
|
|
||||||
GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
|
|
||||||
|
|
||||||
/* Round 3 */
|
|
||||||
HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
|
|
||||||
HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
|
|
||||||
HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
|
|
||||||
HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
|
|
||||||
HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
|
|
||||||
HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
|
|
||||||
HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
|
|
||||||
HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
|
|
||||||
HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
|
|
||||||
HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
|
|
||||||
HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
|
|
||||||
HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
|
|
||||||
HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
|
|
||||||
HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
|
|
||||||
HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
|
|
||||||
HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
|
|
||||||
|
|
||||||
/* Round 4 */
|
|
||||||
II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
|
|
||||||
II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
|
|
||||||
II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
|
|
||||||
II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
|
|
||||||
II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
|
|
||||||
II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
|
|
||||||
II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
|
|
||||||
II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
|
|
||||||
II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
|
|
||||||
II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
|
|
||||||
II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
|
|
||||||
II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
|
|
||||||
II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
|
|
||||||
II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
|
|
||||||
II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
|
|
||||||
II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
|
|
||||||
|
|
||||||
|
|
||||||
state[0] += a;
|
|
||||||
state[1] += b;
|
|
||||||
state[2] += c;
|
|
||||||
state[3] += d;
|
|
||||||
|
|
||||||
/* Zeroize sensitive information.
|
|
||||||
*/
|
|
||||||
MD5_memset ((POINTER)x, 0, sizeof (x));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Encodes input (UINT4) into output (unsigned char). Assumes len is
|
|
||||||
a multiple of 4.
|
|
||||||
*/
|
|
||||||
static void Encode (
|
|
||||||
unsigned char *output,
|
|
||||||
UINT4 *input,
|
|
||||||
unsigned int len)
|
|
||||||
{
|
|
||||||
unsigned int i, j;
|
|
||||||
|
|
||||||
for (i = 0, j = 0; j < len; i++, j += 4) {
|
|
||||||
output[j] = (unsigned char)(input[i] & 0xff);
|
|
||||||
output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
|
|
||||||
output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
|
|
||||||
output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Decodes input (unsigned char) into output (UINT4). Assumes len is
|
|
||||||
a multiple of 4.
|
|
||||||
*/
|
|
||||||
static void Decode (
|
|
||||||
UINT4 *output,
|
|
||||||
unsigned char *input,
|
|
||||||
unsigned int len)
|
|
||||||
{
|
|
||||||
unsigned int i, j;
|
|
||||||
|
|
||||||
for (i = 0, j = 0; j < len; i++, j += 4)
|
|
||||||
output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
|
|
||||||
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Note: Replace "for loop" with standard memcpy if possible.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MD5_memcpy
|
|
||||||
static void MD5_memcpy (output, input, len)
|
|
||||||
POINTER output;
|
|
||||||
POINTER input;
|
|
||||||
unsigned int len;
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
|
||||||
output[i] = input[i];
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Note: Replace "for loop" with standard memset if possible.
|
#ifdef TEST
|
||||||
*/
|
/*
|
||||||
|
Simple test program. Can use it to manually run the tests from
|
||||||
|
RFC1321 for example.
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifndef MD5_memset
|
int
|
||||||
static void MD5_memset (output, value, len)
|
main (int argc, char **argv)
|
||||||
POINTER output;
|
|
||||||
int value;
|
|
||||||
unsigned int len;
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
my_MD5Context context;
|
||||||
|
unsigned char checksum[16];
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
if (argc < 2)
|
||||||
((char *)output)[i] = (char)value;
|
{
|
||||||
|
fprintf (stderr, "usage: %s string-to-hash\n", argv[0]);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
for (j = 1; j < argc; ++j)
|
||||||
|
{
|
||||||
|
printf ("MD5 (\"%s\") = ", argv[j]);
|
||||||
|
my_MD5Init (&context);
|
||||||
|
my_MD5Update (&context, argv[j], strlen (argv[j]));
|
||||||
|
my_MD5Final (checksum, &context);
|
||||||
|
for (i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
printf ("%02x", (unsigned int) checksum[i]);
|
||||||
|
}
|
||||||
|
printf ("\n");
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* TEST */
|
||||||
|
@ -66,7 +66,7 @@ CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL
|
|||||||
|
|
||||||
-- Create general_log if CSV is enabled.
|
-- Create general_log if CSV is enabled.
|
||||||
|
|
||||||
SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, thread_id INTEGER NOT NULL, server_id INTEGER NOT NULL, command_type VARCHAR(64) NOT NULL, argument MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment="General log"', 'SET @dummy = 0');
|
SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, thread_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, command_type VARCHAR(64) NOT NULL, argument MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment="General log"', 'SET @dummy = 0');
|
||||||
|
|
||||||
PREPARE stmt FROM @str;
|
PREPARE stmt FROM @str;
|
||||||
EXECUTE stmt;
|
EXECUTE stmt;
|
||||||
@ -74,13 +74,13 @@ DROP PREPARE stmt;
|
|||||||
|
|
||||||
-- Create slow_log if CSV is enabled.
|
-- Create slow_log if CSV is enabled.
|
||||||
|
|
||||||
SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512) NOT NULL, last_insert_id INTEGER NOT NULL, insert_id INTEGER NOT NULL, server_id INTEGER NOT NULL, sql_text MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment="Slow log"', 'SET @dummy = 0');
|
SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512) NOT NULL, last_insert_id INTEGER NOT NULL, insert_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, sql_text MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment="Slow log"', 'SET @dummy = 0');
|
||||||
|
|
||||||
PREPARE stmt FROM @str;
|
PREPARE stmt FROM @str;
|
||||||
EXECUTE stmt;
|
EXECUTE stmt;
|
||||||
DROP PREPARE stmt;
|
DROP PREPARE stmt;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator int(10) NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
|
CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator INTEGER UNSIGNED NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
|
CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
|
||||||
|
@ -215,6 +215,20 @@ ALTER TABLE func
|
|||||||
ALTER TABLE func
|
ALTER TABLE func
|
||||||
MODIFY type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL;
|
MODIFY type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Modify log tables.
|
||||||
|
#
|
||||||
|
|
||||||
|
SET @old_log_state = @@global.general_log;
|
||||||
|
SET GLOBAL general_log = 'OFF';
|
||||||
|
ALTER TABLE general_log MODIFY COLUMN server_id INTEGER UNSIGNED NOT NULL;
|
||||||
|
SET GLOBAL general_log = @old_log_state;
|
||||||
|
|
||||||
|
SET @old_log_state = @@global.slow_query_log;
|
||||||
|
SET GLOBAL slow_query_log = 'OFF';
|
||||||
|
ALTER TABLE slow_log MODIFY COLUMN server_id INTEGER UNSIGNED NOT NULL;
|
||||||
|
SET GLOBAL slow_query_log = @old_log_state;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Detect whether we had Create_view_priv
|
# Detect whether we had Create_view_priv
|
||||||
#
|
#
|
||||||
@ -471,7 +485,10 @@ ALTER TABLE event MODIFY sql_mode
|
|||||||
'PAD_CHAR_TO_FULL_LENGTH'
|
'PAD_CHAR_TO_FULL_LENGTH'
|
||||||
) DEFAULT '' NOT NULL AFTER on_completion;
|
) DEFAULT '' NOT NULL AFTER on_completion;
|
||||||
ALTER TABLE event MODIFY name char(64) CHARACTER SET utf8 NOT NULL default '';
|
ALTER TABLE event MODIFY name char(64) CHARACTER SET utf8 NOT NULL default '';
|
||||||
ALTER TABLE event ADD COLUMN originator INT(10) NOT NULL AFTER comment;
|
|
||||||
|
ALTER TABLE event MODIFY COLUMN originator INT UNSIGNED NOT NULL;
|
||||||
|
ALTER TABLE event ADD COLUMN originator INT UNSIGNED NOT NULL AFTER comment;
|
||||||
|
|
||||||
ALTER TABLE event MODIFY COLUMN status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED';
|
ALTER TABLE event MODIFY COLUMN status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED';
|
||||||
|
|
||||||
ALTER TABLE event ADD COLUMN time_zone char(64) CHARACTER SET latin1
|
ALTER TABLE event ADD COLUMN time_zone char(64) CHARACTER SET latin1
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
When comparing with ms-sql:
|
|
||||||
|
|
||||||
Check how to get MySQL faster mysql ms-sql
|
|
||||||
|
|
||||||
count_distinct (2000) | 89.00| 39.00|
|
|
||||||
count_distinct_big (120) | 324.00| 121.00|
|
|
||||||
count_distinct_group (1000) | 158.00| 107.00|
|
|
||||||
count_distinct_group_on_key (1000) | 49.00| 17.00|
|
|
||||||
count_distinct_group_on_key_parts (1| 157.00| 108.00|
|
|
||||||
order_by_big (10) | 197.00| 89.00|
|
|
||||||
order_by_big_key (10) | 170.00| 82.00|
|
|
||||||
order_by_big_key2 (10) | 163.00| 73.00|
|
|
||||||
order_by_big_key_desc (10) | 172.00| 84.00|
|
|
||||||
order_by_big_key_diff (10) | 193.00| 89.00|
|
|
||||||
order_by_big_key_prefix (10) | 165.00| 72.00|
|
|
||||||
|
|
||||||
|
|
||||||
Why is the following slow on NT:
|
|
||||||
NT Linux
|
|
||||||
update_of_primary_key_many_keys (256| 560.00| 65.00|
|
|
||||||
|
|
@ -105,13 +105,10 @@ String *Item_func_md5::val_str(String *str)
|
|||||||
str->set_charset(&my_charset_bin);
|
str->set_charset(&my_charset_bin);
|
||||||
if (sptr)
|
if (sptr)
|
||||||
{
|
{
|
||||||
my_MD5_CTX context;
|
|
||||||
uchar digest[16];
|
uchar digest[16];
|
||||||
|
|
||||||
null_value=0;
|
null_value=0;
|
||||||
my_MD5Init (&context);
|
MY_MD5_HASH(digest,(uchar *) sptr->ptr(), sptr->length());
|
||||||
my_MD5Update (&context,(uchar *) sptr->ptr(), sptr->length());
|
|
||||||
my_MD5Final (digest, &context);
|
|
||||||
if (str->alloc(32)) // Ensure that memory is free
|
if (str->alloc(32)) // Ensure that memory is free
|
||||||
{
|
{
|
||||||
null_value=1;
|
null_value=1;
|
||||||
|
@ -439,7 +439,8 @@ void Item_sum::make_field(Send_field *tmp_field)
|
|||||||
|
|
||||||
void Item_sum::print(String *str, enum_query_type query_type)
|
void Item_sum::print(String *str, enum_query_type query_type)
|
||||||
{
|
{
|
||||||
Item **pargs= orig_args;
|
/* orig_args is not filled with valid values until fix_fields() */
|
||||||
|
Item **pargs= fixed ? orig_args : args;
|
||||||
str->append(func_name());
|
str->append(func_name());
|
||||||
for (uint i=0 ; i < arg_count ; i++)
|
for (uint i=0 ; i < arg_count ; i++)
|
||||||
{
|
{
|
||||||
|
@ -6249,7 +6249,7 @@ Can't be set to 1 if --log-slave-updates is used.",
|
|||||||
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"server-id", OPT_SERVER_ID,
|
{"server-id", OPT_SERVER_ID,
|
||||||
"Uniquely identifies the server instance in the community of replication partners.",
|
"Uniquely identifies the server instance in the community of replication partners.",
|
||||||
(uchar**) &server_id, (uchar**) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0,
|
(uchar**) &server_id, (uchar**) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, UINT_MAX32,
|
||||||
0, 0, 0},
|
0, 0, 0},
|
||||||
{"set-variable", 'O',
|
{"set-variable", 'O',
|
||||||
"Change the value of a variable. Please note that this option is deprecated;you can set variables directly with --variable-name=value.",
|
"Change the value of a variable. Please note that this option is deprecated;you can set variables directly with --variable-name=value.",
|
||||||
|
@ -2982,11 +2982,8 @@ void st_table::reset_item_list(List<Item> *item_list) const
|
|||||||
|
|
||||||
void TABLE_LIST::calc_md5(char *buffer)
|
void TABLE_LIST::calc_md5(char *buffer)
|
||||||
{
|
{
|
||||||
my_MD5_CTX context;
|
|
||||||
uchar digest[16];
|
uchar digest[16];
|
||||||
my_MD5Init(&context);
|
MY_MD5_HASH(digest, (uchar *) select_stmt.str, select_stmt.length);
|
||||||
my_MD5Update(&context,(uchar *) select_stmt.str, select_stmt.length);
|
|
||||||
my_MD5Final(digest, &context);
|
|
||||||
sprintf((char *) buffer,
|
sprintf((char *) buffer,
|
||||||
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||||
digest[0], digest[1], digest[2], digest[3],
|
digest[0], digest[1], digest[2], digest[3],
|
||||||
|
@ -1105,12 +1105,20 @@ btr_search_drop_page_hash_when_freed(
|
|||||||
page = buf_page_get_gen(space, page_no, RW_S_LATCH, NULL,
|
page = buf_page_get_gen(space, page_no, RW_S_LATCH, NULL,
|
||||||
BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
|
BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
|
||||||
&mtr);
|
&mtr);
|
||||||
|
/* Because the buffer pool mutex was released by
|
||||||
|
buf_page_peek_if_search_hashed(), it is possible that the
|
||||||
|
block was removed from the buffer pool by another thread
|
||||||
|
before buf_page_get_gen() got a chance to acquire the buffer
|
||||||
|
pool mutex again. Thus, we must check for a NULL return. */
|
||||||
|
|
||||||
|
if (UNIV_LIKELY(page != NULL)) {
|
||||||
|
|
||||||
#ifdef UNIV_SYNC_DEBUG
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE_FROM_HASH);
|
buf_page_dbg_add_level(page, SYNC_TREE_NODE_FROM_HASH);
|
||||||
#endif /* UNIV_SYNC_DEBUG */
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
btr_search_drop_page_hash_index(page);
|
btr_search_drop_page_hash_index(page);
|
||||||
|
}
|
||||||
|
|
||||||
mtr_commit(&mtr);
|
mtr_commit(&mtr);
|
||||||
}
|
}
|
||||||
|
@ -953,6 +953,12 @@ innobase_next_autoinc(
|
|||||||
/* Should never be 0. */
|
/* Should never be 0. */
|
||||||
ut_a(increment > 0);
|
ut_a(increment > 0);
|
||||||
|
|
||||||
|
/* According to MySQL documentation, if the offset is greater than
|
||||||
|
the increment then the offset is ignored. */
|
||||||
|
if (offset > increment) {
|
||||||
|
offset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (max_value <= current) {
|
if (max_value <= current) {
|
||||||
next_value = max_value;
|
next_value = max_value;
|
||||||
} else if (offset <= 1) {
|
} else if (offset <= 1) {
|
||||||
@ -3405,7 +3411,7 @@ skip_field:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Get the upper limit of the MySQL integral type. */
|
Get the upper limit of the MySQL integral and floating-point type. */
|
||||||
|
|
||||||
ulonglong
|
ulonglong
|
||||||
ha_innobase::innobase_get_int_col_max_value(
|
ha_innobase::innobase_get_int_col_max_value(
|
||||||
@ -3450,6 +3456,14 @@ ha_innobase::innobase_get_int_col_max_value(
|
|||||||
case HA_KEYTYPE_LONGLONG:
|
case HA_KEYTYPE_LONGLONG:
|
||||||
max_value = 0x7FFFFFFFFFFFFFFFULL;
|
max_value = 0x7FFFFFFFFFFFFFFFULL;
|
||||||
break;
|
break;
|
||||||
|
case HA_KEYTYPE_FLOAT:
|
||||||
|
/* We use the maximum as per IEEE754-2008 standard, 2^24 */
|
||||||
|
max_value = 0x1000000ULL;
|
||||||
|
break;
|
||||||
|
case HA_KEYTYPE_DOUBLE:
|
||||||
|
/* We use the maximum as per IEEE754-2008 standard, 2^53 */
|
||||||
|
max_value = 0x20000000000000ULL;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
ut_error;
|
ut_error;
|
||||||
}
|
}
|
||||||
@ -3772,7 +3786,7 @@ no_commit:
|
|||||||
will be 0 if get_auto_increment() was not called.*/
|
will be 0 if get_auto_increment() was not called.*/
|
||||||
|
|
||||||
if (auto_inc <= col_max_value
|
if (auto_inc <= col_max_value
|
||||||
&& auto_inc > prebuilt->autoinc_last_value) {
|
&& auto_inc >= prebuilt->autoinc_last_value) {
|
||||||
set_max_autoinc:
|
set_max_autoinc:
|
||||||
ut_a(prebuilt->autoinc_increment > 0);
|
ut_a(prebuilt->autoinc_increment > 0);
|
||||||
|
|
||||||
@ -7650,11 +7664,13 @@ ha_innobase::get_auto_increment(
|
|||||||
|
|
||||||
prebuilt->autoinc_last_value = next_value;
|
prebuilt->autoinc_last_value = next_value;
|
||||||
|
|
||||||
ut_a(prebuilt->autoinc_last_value >= *first_value);
|
if (prebuilt->autoinc_last_value < *first_value) {
|
||||||
|
*first_value = (~(ulonglong) 0);
|
||||||
|
} else {
|
||||||
/* Update the table autoinc variable */
|
/* Update the table autoinc variable */
|
||||||
dict_table_autoinc_update_if_greater(
|
dict_table_autoinc_update_if_greater(
|
||||||
prebuilt->table, prebuilt->autoinc_last_value);
|
prebuilt->table, prebuilt->autoinc_last_value);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* This will force write_row() into attempting an update
|
/* This will force write_row() into attempting an update
|
||||||
of the table's AUTOINC counter. */
|
of the table's AUTOINC counter. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user