Commit b00e7d2d authored by Chad MILLER's avatar Chad MILLER

Merge fix and upstream.

parents 8744675f 2ca84a4c
......@@ -13,80 +13,42 @@
along with this program; if not, write to the Free Software
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
rights reserved.
/* Unlike previous versions of this code, uint32 need not be exactly
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 {
UINT4 state[4]; /* state (ABCD) */
UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} my_MD5_CTX;
cvs_uint32 buf[4];
cvs_uint32 bits[2];
unsigned char in[64];
} my_MD5Context;
#ifdef __cplusplus
extern "C" {
#endif
void my_MD5Init PROTO_LIST ((my_MD5_CTX *));
void my_MD5Update PROTO_LIST
((my_MD5_CTX *, unsigned char *, unsigned int));
void my_MD5Final PROTO_LIST ((unsigned char [16], my_MD5_CTX *));
void my_MD5Init (my_MD5Context *context);
void my_MD5Update (my_MD5Context *context,
unsigned char const *buf, unsigned len);
void my_MD5Final (unsigned char digest[16],
my_MD5Context *context);
#ifdef __cplusplus
}
#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)
......@@ -71,11 +71,11 @@ SUBDIRS = lib/My/SafeProcess
EXTRA_DIST = README \
valgrind.supp \
$(test_SCRIPTS) \
$(nobase_test_DATA)
$(nobase_test_DATA)
# List of directories containing test + result files and the
# 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_backup51_data_be std_data/ndb_backup51_data_le \
std_data/funcs_1 \
......
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.
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
perl mysql-test-run.pl --timer --force --comment=rpl_ndb_row --suite=rpl_ndb,ndb --mysqld=--binlog-format=row --experimental=collections/default.experimental
funcs_1.charset_collation_1 # depends on compile-time decisions
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
......@@ -26,7 +26,7 @@ create temporary table error_log (
) engine=myisam;
# 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;
# Try tload the warnings into a temporary table,
......
......@@ -116,8 +116,8 @@ sub fix_tmpdir {
sub fix_log_error {
my ($self, $config, $group_name, $group)= @_;
my $dir= dirname($group->value('datadir'));
return "$dir/mysqld.err";
my $dir= $self->{ARGS}->{vardir};
return "$dir/log/$group_name.err";
}
sub fix_log {
......@@ -203,7 +203,7 @@ my @mysqld_rules=
{ '#host' => \&fix_host },
{ 'port' => \&fix_port },
{ 'socket' => \&fix_socket },
{ 'log-error' => \&fix_log_error },
{ '#log-error' => \&fix_log_error },
{ 'log' => \&fix_log },
{ 'log-slow-queries' => \&fix_log_slow_queries },
{ '#user' => sub { return shift->{ARGS}->{user} || ""; } },
......@@ -389,7 +389,7 @@ sub post_check_embedded_group {
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
);
......
......@@ -113,8 +113,8 @@ sub check_socket_path_length {
# Create a tempfile name with same length as "path"
my $tmpdir = tempdir( CLEANUP => 0);
my $len = length($path) - length($tmpdir);
my $testfile = $tmpdir . "x" x ($len > 0 ? $len : 1);
my $len = length($path) - length($tmpdir) - 1;
my $testfile = $tmpdir . "/" . "x" x ($len > 0 ? $len : 1);
my $sock;
eval {
$sock= new IO::Socket::UNIX
......@@ -126,17 +126,15 @@ sub check_socket_path_length {
die "Could not create UNIX domain socket: $!"
unless defined $sock;
die "UNIX domain socket patch was truncated"
die "UNIX domain socket path was truncated"
unless ($testfile eq $sock->hostpath());
$truncated= 0; # Yes, it worked!
};
#print "check_socket_path_length, failed: ", $@, '\n' if ($@);
$sock= undef; # Close socket
unlink($testfile); # Remove the physical file
rmdir($tmpdir); # Remove the tempdir
rmtree($tmpdir); # Remove the tempdir and any socket file created
return $truncated;
}
......
......@@ -117,6 +117,7 @@ sub new {
my $output = delete($opts{'output'});
my $error = delete($opts{'error'});
my $verbose = delete($opts{'verbose'});
my $nocore = delete($opts{'nocore'});
my $host = delete($opts{'host'});
my $shutdown = delete($opts{'shutdown'});
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, "--verbose") if $verbose > 0;
push(@safe_args, "--nocore") if $nocore;
# Point the safe_process at the right parent if running on cygwin
push(@safe_args, "--parent-pid=".Cygwin::pid_to_winpid($$)) if IS_CYGWIN;
......
......@@ -45,6 +45,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/resource.h>
#include <unistd.h>
#include <stdarg.h>
#include <stdio.h>
......@@ -149,7 +150,8 @@ int main(int argc, char* const argv[] )
char* const* child_argv= 0;
pid_t own_pid= getpid();
pid_t parent_pid= getppid();
bool nocore = false;
/* Install signal handlers */
signal(SIGTERM, handle_signal);
signal(SIGINT, handle_signal);
......@@ -181,6 +183,9 @@ int main(int argc, char* const argv[] )
start++; /* Step past = */
if ((parent_pid= atoi(start)) == 0)
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
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)
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
buf= 37;
write(pfd[1], &buf, 1);
......
......@@ -69,6 +69,8 @@ sub _mtr_report_test_name ($) {
print _name(), _timestamp();
printf "%-40s ", $tname;
return $tname;
}
......@@ -105,20 +107,48 @@ sub mtr_report_test_passed ($) {
sub mtr_report_test ($) {
my ($tinfo)= @_;
_mtr_report_test_name($tinfo);
my $test_name = _mtr_report_test_name($tinfo);
my $comment= $tinfo->{'comment'};
my $logfile= $tinfo->{'logfile'};
my $warnings= $tinfo->{'warnings'};
my $result= $tinfo->{'result'};
my $retry= $tinfo->{'retries'} ? "retry-" : "";
if ($result eq 'MTR_RES_FAILED'){
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 )
{
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($warnings);
return;
......@@ -126,14 +156,14 @@ sub mtr_report_test ($) {
my $timeout= $tinfo->{'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("\n$tinfo->{'comment'}");
return;
}
else
{
mtr_report("[ fail ]\n Test ended at $timest");
mtr_report("[ $retry$fail ]\n Test ended at $timest");
}
if ( $logfile )
......@@ -176,7 +206,7 @@ sub mtr_report_test ($) {
{
my $timer_str= $tinfo->{timer} || "";
$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
if ( defined $tinfo->{'check'} )
......
......@@ -188,6 +188,8 @@ sub mtr_release_unique_id($) {
flock SEM, LOCK_UN or warn "can't unlock $file.sem";
close SEM;
delete $mtr_unique_ids{$$};
}
......
......@@ -181,12 +181,18 @@ our $opt_client_debugger;
my $config; # The currently running config
my $current_config_name; # The currently running config file template
our $opt_experimental;
our $experimental_test_cases;
my $baseport;
my $opt_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto";
my $build_thread= 0;
my $opt_record;
my $opt_report_features;
my $opt_skip_core;
our $opt_check_testcases= 1;
my $opt_mark_progress;
......@@ -677,14 +683,9 @@ sub run_worker ($) {
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);
if (check_ports_free()){
# Some port was not free(which one has already been printed)
mtr_error("Some port(s) was not free")
}
set_build_thread_ports($thread_num);
# --------------------------------------------------------------------------
# Turn off verbosity in workers, unless explicitly specified
......@@ -804,7 +805,7 @@ sub command_line_setup {
'big-test' => \$opt_big_test,
'combination=s' => \@opt_combinations,
'skip-combinations' => \&collect_option,
'experimental=s' => \$opt_experimental,
'skip-im' => \&ignore_option,
# Specify ports
......@@ -944,12 +945,12 @@ sub command_line_setup {
}
# Look for language files and charsetsdir, use same share
my $path_share= mtr_path_exists("$basedir/share/mysql",
"$basedir/sql/share",
"$basedir/share");
$path_language= mtr_path_exists("$basedir/share/mysql/english",
"$basedir/sql/share/english",
"$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");
if (using_extern())
......@@ -971,6 +972,33 @@ sub command_line_setup {
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 )
{
if ( $arg =~ /^--skip-/ )
......@@ -1094,6 +1122,14 @@ sub command_line_setup {
$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
# --------------------------------------------------------------------------
......@@ -1283,18 +1319,32 @@ sub command_line_setup {
# But a fairly safe range seems to be 5001 - 32767
#
sub set_build_thread_ports($) {
my $build_thread= shift || 0;
my $thread= shift || 0;
if ( lc($build_thread) eq 'auto' ) {
#mtr_report("Requesting build thread... ");
$build_thread= mtr_get_unique_id(250, 299);
if ( !defined $build_thread ) {
mtr_error("Could not get a unique build thread id");
if ( lc($opt_build_thread) eq 'auto' ) {
my $found_free = 0;
$build_thread = 250; # Start attempts from here
while (! $found_free)
{
$build_thread= mtr_get_unique_id($build_thread, 299);
if ( !defined $build_thread ) {
mtr_error("Could not get a unique build thread id");
}
$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;
}
#mtr_report(" - got $build_thread");
}
else
{
$build_thread = $opt_build_thread + $thread - 1;
}
$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
$baseport= $build_thread * 10 + 10000;
......@@ -2448,22 +2498,18 @@ sub kill_leftovers ($) {
# Check that all the ports that are going to
# be used are free
#
sub check_ports_free
sub check_ports_free ($)
{
my @ports_to_check;
for ($baseport..$baseport+9){
push(@ports_to_check, $_);
}
#mtr_report("Checking ports...");
# print "@ports_to_check\n";
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
my $bthread= shift;
my $portbase = $bthread * 10 + 10000;
for ($portbase..$portbase+9){
if (mtr_ping_port($_)){
mtr_report(" - 'localhost:$_' was not free");
return 0; # 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();
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;
mtr_init_args(\$args);
......@@ -3957,6 +4006,7 @@ sub mysqld_arguments ($$$) {
mtr_add_arg($args, "%s", $arg);
}
}
$opt_skip_core = $found_skip_core;
if ( !$found_skip_core )
{
mtr_add_arg($args, "%s", "--core-file");
......@@ -3996,6 +4046,12 @@ sub mysqld_start ($$) {
$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 )
{
gdb_arguments(\$args, \$exe, $mysqld->name());
......@@ -4028,7 +4084,7 @@ sub mysqld_start ($$) {
# Remove the old pidfile if any
unlink($mysqld->value('pid-file'));
my $output= $mysqld->value('log-error');
my $output= $mysqld->value('#log-error');
if ( $opt_valgrind and $opt_debug )
{
# When both --valgrind and --debug is selected, send
......@@ -4048,6 +4104,7 @@ sub mysqld_start ($$) {
error => $output,
append => 1,
verbose => $opt_verbose,
nocore => $opt_skip_core,
host => undef,
shutdown => sub { mysqld_stop($mysqld) },
);
......@@ -4100,12 +4157,6 @@ sub server_need_restart {
return 0;
}
if ( $opt_embedded_server )
{
mtr_verbose_restart($server, "no start or restart for embedded server");
return 0;
}
if ( $tinfo->{'force_restart'} ) {
mtr_verbose_restart($server, "forced in .opt file");
return 1;
......@@ -4335,7 +4386,7 @@ sub start_servers($) {
# Already started
# Write start of testcase to log file
mark_log($mysqld->value('log-error'), $tinfo);
mark_log($mysqld->value('#log-error'), $tinfo);
next;
}
......@@ -4394,7 +4445,7 @@ sub start_servers($) {
mkpath($tmpdir) unless -d $tmpdir;
# 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
if ($mysqld->option('#!run-master-sh') and
......@@ -4445,7 +4496,7 @@ sub start_servers($) {
$tinfo->{comment}=
"Failed to start ".$mysqld->name();
my $logfile= $mysqld->value('log-error');
my $logfile= $mysqld->value('#log-error');
if ( defined $logfile and -f $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;
name
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;
SET GLOBAL event_scheduler= 'ON';
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:
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;
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.
#
......@@ -182,3 +186,4 @@ dt
2001-01-01 01:01:01
2001-01-01 01:01:01
drop tables t1, t2;
End of 5.1 tests.
......@@ -579,3 +579,291 @@ c1
18446744073709551610
18446744073709551615
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,
`user_host` mediumtext 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,
`argument` mediumtext NOT NULL
) 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
user_host mediumtext 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
argument mediumtext NO NULL
show create table mysql.slow_log;
......@@ -80,7 +80,7 @@ slow_log CREATE TABLE `slow_log` (
`db` varchar(512) NOT NULL,
`last_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
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
show fields from mysql.slow_log;
......@@ -94,7 +94,7 @@ rows_examined int(11) NO NULL
db varchar(512) NO NULL
last_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
flush logs;
flush tables;
......@@ -167,7 +167,7 @@ general_log CREATE TABLE `general_log` (
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext 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,
`argument` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
......@@ -183,7 +183,7 @@ slow_log CREATE TABLE `slow_log` (
`db` varchar(512) NOT NULL,
`last_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
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
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,
`user_host` mediumtext 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,
`argument` mediumtext NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='General log'
......@@ -210,7 +210,7 @@ slow_log CREATE TABLE `slow_log` (
`db` varchar(512) NOT NULL,
`last_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
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Slow log'
set global general_log='ON';
......@@ -268,7 +268,7 @@ CREATE TABLE `general_log` (
ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext 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,
`argument` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
......@@ -283,7 +283,7 @@ ON UPDATE CURRENT_TIMESTAMP,
`db` varchar(512) NOT NULL,
`last_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
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
set global general_log='ON';
......
......@@ -227,7 +227,7 @@ event CREATE TABLE `event` (
`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 '',
`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',
`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,
......@@ -241,7 +241,7 @@ general_log CREATE TABLE `general_log` (
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext 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,
`argument` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
......@@ -257,7 +257,7 @@ slow_log CREATE TABLE `slow_log` (
`db` varchar(512) NOT NULL,
`last_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
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
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
@@storage_engine
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
......@@ -60,9 +60,11 @@ SELECT @@global.server_id;
@@global.server_id
0
SET @@global.server_id = 2147483649*2;
Warnings:
Warning 1292 Truncated incorrect server-id value: '4294967298'
SELECT @@global.server_id;
@@global.server_id
4294967298
4294967295
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
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;
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
......
......@@ -123,6 +123,21 @@ execute s1;
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 # Bug#37870: Usage of uninitialized value caused failed assertion.
--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' );
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
SELECT * FROM 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,
`user_host` mediumtext 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,
`argument` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
......@@ -303,7 +303,7 @@ CREATE TABLE `slow_log` (
`db` varchar(512) NOT NULL,
`last_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
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
......
......@@ -40,6 +40,8 @@ drop table t1;
create table t1 (a bit) engine=innodb;
insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
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
alter table t1 add unique (a);
drop table t1;
......
......@@ -1164,5 +1164,21 @@ SET GLOBAL expire_logs_days = @old_eld;
select @@storage_engine;
--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
This diff is collapsed.
......@@ -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.
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;
EXECUTE stmt;
......@@ -74,13 +74,13 @@ DROP PREPARE stmt;
-- 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;
EXECUTE 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;
......
......@@ -215,6 +215,20 @@ ALTER TABLE func
ALTER TABLE func
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
#
......@@ -471,7 +485,10 @@ ALTER TABLE event MODIFY sql_mode
'PAD_CHAR_TO_FULL_LENGTH'
) DEFAULT '' NOT NULL AFTER on_completion;
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 ADD COLUMN time_zone char(64) CHARACTER SET latin1
......
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);
if (sptr)
{
my_MD5_CTX context;
uchar digest[16];
null_value=0;
my_MD5Init (&context);
my_MD5Update (&context,(uchar *) sptr->ptr(), sptr->length());
my_MD5Final (digest, &context);
MY_MD5_HASH(digest,(uchar *) sptr->ptr(), sptr->length());
if (str->alloc(32)) // Ensure that memory is free
{
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)
{
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());
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},
{"server-id", OPT_SERVER_ID,
"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},
{"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.",
......
......@@ -2982,11 +2982,8 @@ void st_table::reset_item_list(List<Item> *item_list) const
void TABLE_LIST::calc_md5(char *buffer)
{
my_MD5_CTX context;
uchar digest[16];
my_MD5Init(&context);
my_MD5Update(&context,(uchar *) select_stmt.str, select_stmt.length);
my_MD5Final(digest, &context);
MY_MD5_HASH(digest, (uchar *) select_stmt.str, select_stmt.length);
sprintf((char *) buffer,
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
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,
BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
&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
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 */
btr_search_drop_page_hash_index(page);
btr_search_drop_page_hash_index(page);
}
mtr_commit(&mtr);
}
......
......@@ -953,6 +953,12 @@ innobase_next_autoinc(
/* Should never be 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) {
next_value = max_value;
} else if (offset <= 1) {
......@@ -3312,8 +3318,8 @@ build_template(
goto include_field;
}
if (bitmap_is_set(table->read_set, i) ||
bitmap_is_set(table->write_set, i)) {
if (bitmap_is_set(table->read_set, i) ||
bitmap_is_set(table->write_set, i)) {
/* This field is needed in the query */
goto include_field;
......@@ -3405,7 +3411,7 @@ build_template(
}
/************************************************************************
Get the upper limit of the MySQL integral type. */
Get the upper limit of the MySQL integral and floating-point type. */
ulonglong
ha_innobase::innobase_get_int_col_max_value(
......@@ -3416,7 +3422,7 @@ ha_innobase::innobase_get_int_col_max_value(
switch(field->key_type()) {
/* TINY */
case HA_KEYTYPE_BINARY:
case HA_KEYTYPE_BINARY:
max_value = 0xFFULL;
break;
case HA_KEYTYPE_INT8:
......@@ -3430,7 +3436,7 @@ ha_innobase::innobase_get_int_col_max_value(
max_value = 0x7FFFULL;
break;
/* MEDIUM */
case HA_KEYTYPE_UINT24:
case HA_KEYTYPE_UINT24:
max_value = 0xFFFFFFULL;
break;
case HA_KEYTYPE_INT24:
......@@ -3444,12 +3450,20 @@ ha_innobase::innobase_get_int_col_max_value(
max_value = 0x7FFFFFFFULL;
break;
/* BIG */
case HA_KEYTYPE_ULONGLONG:
case HA_KEYTYPE_ULONGLONG:
max_value = 0xFFFFFFFFFFFFFFFFULL;
break;
case HA_KEYTYPE_LONGLONG:
max_value = 0x7FFFFFFFFFFFFFFFULL;
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:
ut_error;
}
......@@ -3772,7 +3786,7 @@ ha_innobase::write_row(
will be 0 if get_auto_increment() was not called.*/
if (auto_inc <= col_max_value
&& auto_inc > prebuilt->autoinc_last_value) {
&& auto_inc >= prebuilt->autoinc_last_value) {
set_max_autoinc:
ut_a(prebuilt->autoinc_increment > 0);
......@@ -7650,11 +7664,13 @@ ha_innobase::get_auto_increment(
prebuilt->autoinc_last_value = next_value;
ut_a(prebuilt->autoinc_last_value >= *first_value);
/* Update the table autoinc variable */
dict_table_autoinc_update_if_greater(
prebuilt->table, prebuilt->autoinc_last_value);
if (prebuilt->autoinc_last_value < *first_value) {
*first_value = (~(ulonglong) 0);
} else {
/* Update the table autoinc variable */
dict_table_autoinc_update_if_greater(
prebuilt->table, prebuilt->autoinc_last_value);
}
} else {
/* This will force write_row() into attempting an update
of the table's AUTOINC counter. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment