diff --git a/VC++Files/libmysqld/libmysqld.vcproj b/VC++Files/libmysqld/libmysqld.vcproj
index 32a2e098564..0ee0cf8aa2d 100644
--- a/VC++Files/libmysqld/libmysqld.vcproj
+++ b/VC++Files/libmysqld/libmysqld.vcproj
@@ -2050,6 +2050,42 @@
PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
)
{
@@ -277,8 +277,8 @@ sub collect_one_test_case($$$$$$$) {
my $disabled_file= "$testdir/$tname.disabled";
my $im_opt_file= "$testdir/$tname-im.opt";
- $tinfo->{'master_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : [];
- $tinfo->{'slave_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : [];
+ $tinfo->{'master_opt'}= [];
+ $tinfo->{'slave_opt'}= [];
$tinfo->{'slave_mi'}= [];
if ( -f $master_opt_file )
@@ -301,7 +301,6 @@ sub collect_one_test_case($$$$$$$) {
if ( defined $value )
{
$tinfo->{'timezone'}= $value;
- $tinfo->{'skip'}= 1 if $::glob_win32; # FIXME server unsets TZ
last MASTER_OPT;
}
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index 4d88c9b3322..86a4312e0c8 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -781,7 +781,15 @@ sub mtr_record_dead_children () {
}
sub start_reap_all {
- $SIG{CHLD}= 'IGNORE'; # FIXME is this enough?
+ # This causes terminating processes to not become zombies, avoiding
+ # the need for (or possibility of) explicit waitpid().
+ $SIG{CHLD}= 'IGNORE';
+
+ # On some platforms (Linux, QNX, OSX, ...) there is potential race
+ # here. If a process terminated before setting $SIG{CHLD} (but after
+ # any attempt to waitpid() it), it will still be a zombie. So we
+ # have to handle any such process here.
+ while(waitpid(-1, &WNOHANG) > 0) { };
}
sub stop_reap_all {
diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl
index 515988ee5c7..88ddbf63d0f 100644
--- a/mysql-test/lib/mtr_report.pl
+++ b/mysql-test/lib/mtr_report.pl
@@ -185,39 +185,57 @@ sub mtr_report_stats ($) {
}
# ----------------------------------------------------------------------
+ # If a debug run, there might be interesting information inside
+ # the "var/log/*.err" files. We save this info in "var/log/warnings"
# ----------------------------------------------------------------------
if ( ! $::glob_use_running_server )
{
+ # Save and report if there was any fatal warnings/errors in err logs
- # Report if there was any fatal warnings/errors in the log files
- #
- unlink("$::opt_vardir/log/warnings");
- unlink("$::opt_vardir/log/warnings.tmp");
- # Remove some non fatal warnings from the log files
+ my $warnlog= "$::opt_vardir/log/warnings";
-# FIXME what is going on ????? ;-)
-# sed -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' \
-# var/log/*.err \
-# | sed -e 's!Warning: Table:.* on rename!!g' \
-# > var/log/warnings.tmp;
-#
-# found_error=0;
-# # Find errors
-# for i in "^Warning:" "^Error:" "^==.* at 0x"
-# do
-# if ( $GREP "$i" var/log/warnings.tmp >> var/log/warnings )
-# {
-# found_error=1
-# }
-# done
-# unlink("$::opt_vardir/log/warnings.tmp");
-# if ( $found_error= "1" )
-# {
-# print "WARNING: Got errors/warnings while running tests. Please examine\n"
-# print "$::opt_vardir/log/warnings for details.\n"
-# }
-# }
+ unless ( open(WARN, ">$warnlog") )
+ {
+ mtr_warning("can't write to the file \"$warnlog\": $!");
+ }
+ else
+ {
+ my $found_problems= 0; # Some warnings are errors...
+
+ # We report different types of problems in order
+ foreach my $pattern ( "^Warning:", "^Error:", "^==.* at 0x" )
+ {
+ foreach my $errlog ( sort glob("$::opt_vardir/log/*.err") )
+ {
+ unless ( open(ERR, $errlog) )
+ {
+ mtr_warning("can't read $errlog");
+ next;
+ }
+ while ( )
+ {
+ # Skip some non fatal warnings from the log files
+ if ( /Warning:\s+Table:.* on (delete|rename)/ or
+ /Warning:\s+Setting lower_case_table_names=2/ or
+ /Warning:\s+One can only use the --user.*root/ )
+ {
+ next; # Skip these lines
+ }
+ if ( /$pattern/ )
+ {
+ $found_problems= 1;
+ print WARN $_;
+ }
+ }
+ }
+ if ( $found_problems )
+ {
+ mtr_warning("Got errors/warnings while running tests, please examine",
+ "\"$warnlog\" for details.");
+ }
+ }
+ }
}
print "\n";
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 6cd878fce70..6f9400d4fff 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -157,7 +157,8 @@ our $path_client_bindir;
our $path_language;
our $path_timefile;
our $path_manager_log; # Used by mysqldadmin
-our $path_mysqltest_log;
+our $path_slave_load_tmpdir; # What is this?!
+our $path_mysqltest_log;
our $path_my_basedir;
our $opt_vardir; # A path but set directly on cmd line
our $opt_tmpdir; # A path but set directly on cmd line
@@ -485,6 +486,9 @@ sub initial_setup () {
$glob_basedir= dirname($glob_mysql_test_dir);
$glob_mysql_bench_dir= "$glob_basedir/mysql-bench"; # FIXME make configurable
+ # needs to be same length to test logging (FIXME what???)
+ $path_slave_load_tmpdir= "../../var/tmp";
+
$path_my_basedir=
$opt_source_dist ? $glob_mysql_test_dir : $glob_basedir;
@@ -512,15 +516,26 @@ sub command_line_setup () {
my $im_mysqld1_port= 9312;
my $im_mysqld2_port= 9314;
+ #
+ # To make it easier for different devs to work on the same host,
+ # an environment variable can be used to control all ports. A small
+ # number is to be used, 0 - 16 or similar.
+ #
+ # Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x
+ # versions of this script, else a 4.0 test run might conflict with a
+ # 5.1 test run, even if different MTR_BUILD_THREAD is used. This means
+ # all port numbers might not be used in this version of the script.
+ #
if ( $ENV{'MTR_BUILD_THREAD'} )
{
- $opt_master_myport= $ENV{'MTR_BUILD_THREAD'} * 40 + 8120;
- $opt_slave_myport= $opt_master_myport + 16;
- $opt_ndbcluster_port= $opt_master_myport + 24;
- $opt_ndbcluster_port_slave= $opt_master_myport + 32;
- $im_port= $opt_master_myport + 10;
- $im_mysqld1_port= $opt_master_myport + 12;
- $im_mysqld2_port= $opt_master_myport + 14;
+ # Up to two masters, up to three slaves
+ $opt_master_myport= $ENV{'MTR_BUILD_THREAD'} * 10 + 10000; # and 1
+ $opt_slave_myport= $opt_master_myport + 2; # and 3 4
+ $opt_ndbcluster_port= $opt_master_myport + 5;
+ $opt_ndbcluster_port_slave= $opt_master_myport + 6;
+ $im_port= $opt_master_myport + 7;
+ $im_mysqld1_port= $opt_master_myport + 8;
+ $im_mysqld2_port= $opt_master_myport + 9;
}
# Read the command line
@@ -680,6 +695,7 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
$opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir;
+ $opt_tmpdir =~ s,/+$,,; # Remove ending slash if any
# FIXME maybe not needed?
$path_manager_log= "$opt_vardir/log/manager.log"
unless $path_manager_log;
@@ -1118,12 +1134,14 @@ sub environment_setup () {
$ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
$ENV{'MYSQL_TEST_WINDIR'}= $glob_mysql_test_dir;
$ENV{'MYSQLTEST_VARDIR'}= $opt_vardir;
- $ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_WINMYSOCK'}= $master->[0]->{'path_mysock'};
+ $ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_mysock'};
$ENV{'MASTER_MYPORT'}= $master->[0]->{'path_myport'};
$ENV{'MASTER_MYPORT1'}= $master->[1]->{'path_myport'};
$ENV{'SLAVE_MYPORT'}= $slave->[0]->{'path_myport'};
+ $ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'path_myport'};
+ $ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'path_myport'};
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
$ENV{'MYSQL_TCP_PORT'}= 3306;
@@ -1131,6 +1149,7 @@ sub environment_setup () {
$ENV{'NDBCLUSTER_PORT_SLAVE'}=$opt_ndbcluster_port_slave;
$ENV{'IM_PATH_PID'}= $instance_manager->{path_pid};
+ $ENV{'IM_PORT'}= $instance_manager->{port};
$ENV{'IM_MYSQLD1_SOCK'}= $instance_manager->{instances}->[0]->{path_sock};
$ENV{'IM_MYSQLD1_PORT'}= $instance_manager->{instances}->[0]->{port};
@@ -1149,15 +1168,20 @@ sub environment_setup () {
}
}
+ $ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set
+
# We are nice and report a bit about our settings
- print "Using MTR_BUILD_THREAD = ",$ENV{MTR_BUILD_THREAD} || 0,"\n";
- print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n";
- print "Using MASTER_MYPORT1 = $ENV{MASTER_MYPORT1}\n";
- print "Using SLAVE_MYPORT = $ENV{SLAVE_MYPORT}\n";
- print "Using NDBCLUSTER_PORT = $ENV{NDBCLUSTER_PORT}\n";
+ print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n";
+ print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n";
+ print "Using MASTER_MYPORT1 = $ENV{MASTER_MYPORT1}\n";
+ print "Using SLAVE_MYPORT = $ENV{SLAVE_MYPORT}\n";
+ print "Using SLAVE_MYPORT1 = $ENV{SLAVE_MYPORT1}\n";
+ print "Using SLAVE_MYPORT2 = $ENV{SLAVE_MYPORT2}\n";
+ print "Using NDBCLUSTER_PORT = $ENV{NDBCLUSTER_PORT}\n";
print "Using NDBCLUSTER_PORT_SLAVE = $ENV{NDBCLUSTER_PORT_SLAVE}\n";
- print "Using IM_MYSQLD1_PORT = $ENV{'IM_MYSQLD1_PORT'}\n";
- print "Using IM_MYSQLD2_PORT = $ENV{'IM_MYSQLD2_PORT'}\n";
+ print "Using IM_PORT = $ENV{IM_PORT}\n";
+ print "Using IM_MYSQLD1_PORT = $ENV{IM_MYSQLD1_PORT}\n";
+ print "Using IM_MYSQLD2_PORT = $ENV{IM_MYSQLD2_PORT}\n";
}
@@ -1208,6 +1232,7 @@ sub kill_running_server () {
mkpath("$opt_vardir/log"); # Needed for mysqladmin log
mtr_kill_leftovers();
+ $using_ndbcluster_master= $opt_with_ndbcluster;
ndbcluster_stop();
$master->[0]->{'ndbcluster'}= 1;
ndbcluster_stop_slave();
@@ -1447,6 +1472,7 @@ sub ndbcluster_start ($) {
}
if ( $using_ndbcluster_master )
{
+ # Master already started
return 0;
}
# FIXME, we want to _append_ output to file $file_ndb_testrun_log instead of /dev/null
@@ -1879,7 +1905,7 @@ EOF
;
print OUT "nonguarded\n" if $instance->{'nonguarded'};
- print OUT "old-log-format\n" if $instance->{'old_log_format'};
+ print OUT "log-output=FILE\n" if $instance->{'old_log_format'};
print OUT "\n";
}
@@ -1956,7 +1982,8 @@ sub run_testcase ($) {
{
if ( $tinfo->{'master_restart'} or
$master->[0]->{'running_master_is_special'} or
- ( $tinfo->{'ndb_test'} != $using_ndbcluster_master ) )
+ # Stop if cluster is started but test cases does not need cluster
+ ( $tinfo->{'ndb_test'} != $using_ndbcluster_master ) )
{
stop_masters();
$master->[0]->{'running_master_is_special'}= 0; # Forget why we stopped
@@ -2011,12 +2038,16 @@ sub run_testcase ($) {
{
if ( $master->[0]->{'ndbcluster'} )
{
+ # Cluster is not started
+
+ # Call ndbcluster_start to check if test case needs cluster
+ # Start it if not already started
$master->[0]->{'ndbcluster'}= ndbcluster_start($tinfo->{'ndb_test'});
- if ( $master->[0]->{'ndbcluster'} )
- {
- report_failure_and_restart($tinfo);
- return;
- }
+ if ( $master->[0]->{'ndbcluster'} )
+ {
+ report_failure_and_restart($tinfo);
+ return;
+ }
}
if ( ! $master->[0]->{'pid'} )
{
@@ -2033,6 +2064,7 @@ sub run_testcase ($) {
}
if ( $using_ndbcluster_master and ! $master->[1]->{'pid'} )
{
+ # Test needs cluster, start an extra mysqld connected to cluster
mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
$master->[1]->{'pid'}=
mysqld_start('master',1,$tinfo->{'master_opt'},[],
@@ -2355,15 +2387,15 @@ sub mysqld_arguments ($$$$$$) {
mtr_add_arg($args, "%s--skip-innodb", $prefix);
}
- if ( $opt_skip_ndbcluster )
+ if ( $opt_skip_ndbcluster || !$using_ndbcluster)
{
mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
}
- if ( $using_ndbcluster )
+ else
{
mtr_add_arg($args, "%s--ndbcluster", $prefix);
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
- $opt_ndbconnectstring);
+ $opt_ndbconnectstring);
mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
}
}
@@ -2549,6 +2581,7 @@ sub mysqld_start ($$$$$) {
my $slave_master_info= shift;
my $using_ndbcluster= shift;
+
my $args; # Arg vector
my $exe;
my $pid;
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 6851f4c9d49..df3b8090ab0 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -247,11 +247,16 @@ MYSQL_MANAGER_USER=root
# an environment variable can be used to control all ports. A small
# number is to be used, 0 - 16 or similar.
#
+# Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x
+# versions of this script, else a 4.0 test run might conflict with a
+# 5.1 test run, even if different MTR_BUILD_THREAD is used. This means
+# all port numbers might not be used in this version of the script.
+#
if [ -n "$MTR_BUILD_THREAD" ] ; then
- MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 5 + 10000`
+ MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 10 + 10000`
MYSQL_MANAGER_PORT=`expr $MASTER_MYPORT + 2`
SLAVE_MYPORT=`expr $MASTER_MYPORT + 3`
- NDBCLUSTER_PORT=`expr $MASTER_MYPORT + 4`
+ NDBCLUSTER_PORT=`expr $MASTER_MYPORT + 6`
echo "Using MTR_BUILD_THREAD = $MTR_BUILD_THREAD"
echo "Using MASTER_MYPORT = $MASTER_MYPORT"
@@ -1382,7 +1387,7 @@ start_master()
fi
if [ x$MASTER_MYSQLDBINLOG = x1 ]
then
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1"
+ MASTER_MYSQLD_BINLOG_OPT="--log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1"
fi
if [ -z "$DO_BENCH" -a -z "$DO_STRESS" ]
then
@@ -1409,6 +1414,7 @@ start_master()
--loose-binlog-show-xid=0 \
$MASTER_40_ARGS \
$SMALL_SERVER \
+ $MASTER_MYSQLD_BINLOG_OPT \
$EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \
$NOT_FIRST_MASTER_EXTRA_OPTS $CURR_MASTER_MYSQLD_TRACE"
else
@@ -1432,6 +1438,7 @@ start_master()
--loose-binlog-show-xid=0 \
$MASTER_40_ARGS \
$SMALL_SERVER \
+ $MASTER_MYSQLD_BINLOG_OPT \
$EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \
$NOT_FIRST_MASTER_EXTRA_OPTS"
fi
@@ -1574,7 +1581,7 @@ start_slave()
if [ x$SLAVE_MYSQLDBINLOG = x1 ]
then
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --log-bin=$MYSQL_TEST_DIR/var/log/$slave_ident-bin --log-slave-updates"
+ SLAVE_MYSQLD_BINLOG_OPT="--log-bin=$MYSQL_TEST_DIR/var/log/$slave_ident-bin --log-slave-updates"
fi
$RM -f $slave_datadir/log.*
@@ -1603,6 +1610,7 @@ start_slave()
--log-bin-trust-function-creators \
--loose-binlog-show-xid=0 \
$SMALL_SERVER \
+ $SLAVE_MYSQLD_BINLOG_OPT \
$EXTRA_SLAVE_MYSQLD_OPT $EXTRA_SLAVE_OPT \
$USE_NDBCLUSTER_SLAVE_OPT"
CUR_MYERR=$slave_err
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index 89f30c9d1f4..2fe4db859b5 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -145,12 +145,12 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1003 select sql_no_cache last_insert_id() AS `last_insert_id()`
insert into t1 set i = 254;
-ERROR 23000: Duplicate entry '254' for key 1
+ERROR 23000: Duplicate entry '254' for key 'PRIMARY'
select last_insert_id();
last_insert_id()
255
insert into t1 set i = null;
-ERROR 23000: Duplicate entry '255' for key 1
+ERROR 23000: Duplicate entry '255' for key 'PRIMARY'
select last_insert_id();
last_insert_id()
0
@@ -178,7 +178,7 @@ select last_insert_id();
last_insert_id()
2
insert into t1 values (NULL, 10);
-ERROR 23000: Duplicate entry '10' for key 2
+ERROR 23000: Duplicate entry '10' for key 'b'
select last_insert_id();
last_insert_id()
0
@@ -379,7 +379,7 @@ key (rowid), unique(val));
replace into t1 (val) values ('1'),('2');
replace into t1 (val) values ('1'),('2');
insert into t1 (val) values ('1'),('2');
-ERROR 23000: Duplicate entry '1' for key 2
+ERROR 23000: Duplicate entry '1' for key 'val'
select * from t1;
rowid val
3 1
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
index c40fd696704..ba6ed396f93 100644
--- a/mysql-test/r/bdb.result
+++ b/mysql-test/r/bdb.result
@@ -48,7 +48,7 @@ id parent_id level
15 102 2
update t1 set id=id+1000;
update t1 set id=1024 where id=1009;
-ERROR 23000: Duplicate entry '1024' for key 1
+ERROR 23000: Duplicate entry '1024' for key 'PRIMARY'
select * from t1;
id parent_id level
1001 100 0
@@ -270,7 +270,7 @@ n after commit
commit;
insert into t1 values (5);
insert into t1 values (4);
-ERROR 23000: Duplicate entry '4' for key 1
+ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
commit;
select n, "after commit" from t1;
n after commit
@@ -279,7 +279,7 @@ n after commit
set autocommit=1;
insert into t1 values (6);
insert into t1 values (4);
-ERROR 23000: Duplicate entry '4' for key 1
+ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
select n from t1;
n
4
@@ -343,7 +343,7 @@ drop table t1;
CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=bdb;
insert into t1 values ('pippo', 12);
insert into t1 values ('pippo', 12);
-ERROR 23000: Duplicate entry 'pippo' for key 1
+ERROR 23000: Duplicate entry 'pippo' for key 'PRIMARY'
delete from t1;
delete from t1 where id = 'pippo';
select * from t1;
@@ -498,9 +498,9 @@ UNIQUE ggid (ggid)
insert into t1 (ggid,passwd) values ('test1','xxx');
insert into t1 (ggid,passwd) values ('test2','yyy');
insert into t1 (ggid,passwd) values ('test2','this will fail');
-ERROR 23000: Duplicate entry 'test2' for key 2
+ERROR 23000: Duplicate entry 'test2' for key 'ggid'
insert into t1 (ggid,id) values ('this will fail',1);
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t1 where ggid='test1';
id ggid email passwd
1 test1 xxx
@@ -513,7 +513,7 @@ id ggid email passwd
replace into t1 (ggid,id) values ('this will work',1);
replace into t1 (ggid,passwd) values ('test2','this will work');
update t1 set id=100,ggid='test2' where id=1;
-ERROR 23000: Duplicate entry 'test2' for key 2
+ERROR 23000: Duplicate entry 'test2' for key 'ggid'
select * from t1;
id ggid email passwd
1 this will work
@@ -1047,7 +1047,7 @@ create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(3
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-ERROR 23000: Duplicate entry '1-1' for key 1
+ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
select id from t1;
id
0
@@ -1065,7 +1065,7 @@ insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJ
LOCK TABLES t1 WRITE;
begin;
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-ERROR 23000: Duplicate entry '1-1' for key 1
+ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
select id from t1;
id
0
@@ -1487,7 +1487,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where
alter table t1 add unique(v);
-ERROR 23000: Duplicate entry '{ ' for key 1
+ERROR 23000: Duplicate entry '{ ' for key 'v_2'
alter table t1 add key(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
qq
@@ -1847,16 +1847,16 @@ drop table t1;
create table t1 (a char(10), unique (a));
insert into t1 values ('a ');
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a' for key 1
+ERROR 23000: Duplicate entry 'a' for key 'a'
alter table t1 modify a varchar(10);
insert into t1 values ('a '),('a '),('a '),('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
update t1 set a='a ' where a like 'a%';
select concat(a,'.') from t1;
concat(a,'.')
diff --git a/mysql-test/r/binlog_stm_insert_select.result b/mysql-test/r/binlog_stm_insert_select.result
index 42bba580f47..35e328a769c 100644
--- a/mysql-test/r/binlog_stm_insert_select.result
+++ b/mysql-test/r/binlog_stm_insert_select.result
@@ -4,7 +4,7 @@ create table t2(a int);
insert into t2 values(1),(2);
reset master;
insert into t1 select * from t2;
-ERROR 23000: Duplicate entry '2' for key 1
+ERROR 23000: Duplicate entry '2' for key 'a'
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
@@ -18,7 +18,7 @@ create table t1(a int);
insert into t1 values(1),(1);
reset master;
create table t2(unique(a)) select a from t1;
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'a'
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
diff --git a/mysql-test/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/r/binlog_stm_mix_innodb_myisam.result
index 5d75bf79990..59280961e41 100644
--- a/mysql-test/r/binlog_stm_mix_innodb_myisam.result
+++ b/mysql-test/r/binlog_stm_mix_innodb_myisam.result
@@ -185,7 +185,7 @@ master-bin.000001 258 Query 1 # use `test`; insert into t1 values(18)
master-bin.000001 346 Xid 1 # COMMIT /* xid= */
delete from t1;
delete from t2;
-alter table t2 type=MyISAM;
+alter table t2 engine=MyISAM;
insert into t1 values (1);
begin;
select * from t1 for update;
@@ -239,20 +239,20 @@ master-bin.000001 373 Query 1 # use `test`; delete from t1
master-bin.000001 450 Xid 1 # COMMIT /* xid= */
master-bin.000001 477 Query 1 # use `test`; delete from t2
master-bin.000001 554 Xid 1 # COMMIT /* xid= */
-master-bin.000001 581 Query 1 # use `test`; alter table t2 type=MyISAM
-master-bin.000001 670 Query 1 # use `test`; insert into t1 values (1)
-master-bin.000001 758 Xid 1 # COMMIT /* xid= */
-master-bin.000001 785 Query 1 # use `test`; insert into t2 values (20)
-master-bin.000001 874 Query 1 # use `test`; drop table t1,t2
-master-bin.000001 953 Query 1 # use `test`; create temporary table ti (a int) engine=innodb
-master-bin.000001 1063 Query 1 # use `test`; insert into ti values(1)
-master-bin.000001 1150 Xid 1 # COMMIT /* xid= */
-master-bin.000001 1177 Query 1 # use `test`; create temporary table t1 (a int) engine=myisam
-master-bin.000001 1287 Query 1 # use `test`; insert t1 values (1)
-master-bin.000001 1370 Query 1 # use `test`; create table t0 (n int)
-master-bin.000001 1456 Query 1 # use `test`; insert t0 select * from t1
-master-bin.000001 1545 Query 1 # use `test`; insert into t0 select GET_LOCK("lock1",null)
-master-bin.000001 1652 Query 1 # use `test`; create table t2 (n int) engine=innodb
-master-bin.000001 1752 Query 1 # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti`
+master-bin.000001 581 Query 1 # use `test`; alter table t2 engine=MyISAM
+master-bin.000001 672 Query 1 # use `test`; insert into t1 values (1)
+master-bin.000001 760 Xid 1 # COMMIT /* xid= */
+master-bin.000001 787 Query 1 # use `test`; insert into t2 values (20)
+master-bin.000001 876 Query 1 # use `test`; drop table t1,t2
+master-bin.000001 955 Query 1 # use `test`; create temporary table ti (a int) engine=innodb
+master-bin.000001 1065 Query 1 # use `test`; insert into ti values(1)
+master-bin.000001 1152 Xid 1 # COMMIT /* xid= */
+master-bin.000001 1179 Query 1 # use `test`; create temporary table t1 (a int) engine=myisam
+master-bin.000001 1289 Query 1 # use `test`; insert t1 values (1)
+master-bin.000001 1372 Query 1 # use `test`; create table t0 (n int)
+master-bin.000001 1458 Query 1 # use `test`; insert t0 select * from t1
+master-bin.000001 1547 Query 1 # use `test`; insert into t0 select GET_LOCK("lock1",null)
+master-bin.000001 1654 Query 1 # use `test`; create table t2 (n int) engine=innodb
+master-bin.000001 1754 Query 1 # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti`
do release_lock("lock1");
drop table t0,t2;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 0e79dba8298..fc0d6c73cf4 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -162,7 +162,7 @@ Note 1051 Unknown table 't2'
CREATE TABLE t1 (a int not null);
INSERT INTO t1 values (1),(2),(1);
CREATE TABLE t2 (primary key(a)) SELECT * FROM t1;
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
SELECT * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
DROP TABLE t1;
@@ -280,7 +280,7 @@ create table if not exists t1 select 3 as 'a',4 as 'b';
Warnings:
Note 1050 Table 't1' already exists
create table if not exists t1 select 3 as 'a',3 as 'b';
-ERROR 23000: Duplicate entry '3' for key 1
+ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
select * from t1;
a b
1 1
diff --git a/mysql-test/r/create_select_tmp.result b/mysql-test/r/create_select_tmp.result
index 668547bcff9..f499e539baf 100644
--- a/mysql-test/r/create_select_tmp.result
+++ b/mysql-test/r/create_select_tmp.result
@@ -2,19 +2,19 @@ drop table if exists t1, t2;
CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1);
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
drop table t1;
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index 2e14fe34430..fa47959579f 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -132,7 +132,7 @@ a INTEGER NOT NULL,
b VARCHAR(50) NOT NULL DEFAULT '',
PRIMARY KEY (a),
KEY b (b(10))
-) TYPE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+) ENGINE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
@@ -152,7 +152,7 @@ a INTEGER NOT NULL,
b VARCHAR(50) NOT NULL DEFAULT '',
PRIMARY KEY (a),
KEY b (b(10))
-) TYPE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+) ENGINE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index b2a22036cb5..5fdab07e1d2 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -296,9 +296,9 @@ create table t1 (c varchar(30) character set utf8, unique(c(10)));
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
insert into t1 values ('aaaaaaaaaa');
insert into t1 values ('aaaaaaaaaaa');
-ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 1
+ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 'c'
insert into t1 values ('aaaaaaaaaaaa');
-ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 1
+ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 'c'
insert into t1 values (repeat('b',20));
select c c1 from t1 where c='1';
c1
@@ -329,9 +329,9 @@ create table t1 (c varchar(30) character set utf8, unique(c(10))) engine=innodb;
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
insert into t1 values ('aaaaaaaaaa');
insert into t1 values ('aaaaaaaaaaa');
-ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 1
+ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 'c'
insert into t1 values ('aaaaaaaaaaaa');
-ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 1
+ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 'c'
insert into t1 values (repeat('b',20));
select c c1 from t1 where c='1';
c1
@@ -363,46 +363,46 @@ insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
insert into t1 values ('a');
insert into t1 values ('aa');
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'c'
insert into t1 values ('b');
insert into t1 values ('bb');
insert into t1 values ('bbb');
-ERROR 23000: Duplicate entry 'bbb' for key 1
+ERROR 23000: Duplicate entry 'bbb' for key 'c'
insert into t1 values ('а');
insert into t1 values ('аа');
insert into t1 values ('ааа');
-ERROR 23000: Duplicate entry 'ааа' for key 1
+ERROR 23000: Duplicate entry 'ааа' for key 'c'
insert into t1 values ('б');
insert into t1 values ('бб');
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'ббб' for key 1
+ERROR 23000: Duplicate entry 'ббб' for key 'c'
insert into t1 values ('ꪪ');
insert into t1 values ('ꪪꪪ');
insert into t1 values ('ꪪꪪꪪ');
-ERROR 23000: Duplicate entry 'ꪪꪪ' for key 1
+ERROR 23000: Duplicate entry 'ꪪꪪ' for key 'c'
drop table t1;
create table t1 (c char(3) character set utf8, unique (c(2))) engine=innodb;
insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
insert into t1 values ('a');
insert into t1 values ('aa');
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'c'
insert into t1 values ('b');
insert into t1 values ('bb');
insert into t1 values ('bbb');
-ERROR 23000: Duplicate entry 'bbb' for key 1
+ERROR 23000: Duplicate entry 'bbb' for key 'c'
insert into t1 values ('а');
insert into t1 values ('аа');
insert into t1 values ('ааа');
-ERROR 23000: Duplicate entry 'ааа' for key 1
+ERROR 23000: Duplicate entry 'ааа' for key 'c'
insert into t1 values ('б');
insert into t1 values ('бб');
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'ббб' for key 1
+ERROR 23000: Duplicate entry 'ббб' for key 'c'
insert into t1 values ('ꪪ');
insert into t1 values ('ꪪꪪ');
insert into t1 values ('ꪪꪪꪪ');
-ERROR 23000: Duplicate entry 'ꪪꪪ' for key 1
+ERROR 23000: Duplicate entry 'ꪪꪪ' for key 'c'
drop table t1;
create table t1 (
c char(10) character set utf8,
@@ -416,14 +416,14 @@ t1 CREATE TABLE `t1` (
) ENGINE=MEMORY DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
-ERROR 23000: Duplicate entry 'aa' for key 1
+ERROR 23000: Duplicate entry 'aa' for key 'a'
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'a'
insert into t1 values ('б');
insert into t1 values ('бб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c;
c_all
a
@@ -452,14 +452,14 @@ t1 CREATE TABLE `t1` (
) ENGINE=MEMORY DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
-ERROR 23000: Duplicate entry 'aa' for key 1
+ERROR 23000: Duplicate entry 'aa' for key 'a'
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'a'
insert into t1 values ('б');
insert into t1 values ('бб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c;
c_all
a
@@ -482,14 +482,14 @@ unique key a (c(1))
) engine=bdb;
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
-ERROR 23000: Duplicate entry 'aa' for key 1
+ERROR 23000: Duplicate entry 'aa' for key 'a'
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'a'
insert into t1 values ('б');
insert into t1 values ('бб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c;
c_all
a
@@ -510,9 +510,9 @@ create table t1 (c varchar(30) character set utf8 collate utf8_bin, unique(c(10)
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
insert into t1 values ('aaaaaaaaaa');
insert into t1 values ('aaaaaaaaaaa');
-ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 1
+ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 'c'
insert into t1 values ('aaaaaaaaaaaa');
-ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 1
+ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 'c'
insert into t1 values (repeat('b',20));
select c c1 from t1 where c='1';
c1
@@ -544,23 +544,23 @@ insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
insert into t1 values ('a');
insert into t1 values ('aa');
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'c'
insert into t1 values ('b');
insert into t1 values ('bb');
insert into t1 values ('bbb');
-ERROR 23000: Duplicate entry 'bbb' for key 1
+ERROR 23000: Duplicate entry 'bbb' for key 'c'
insert into t1 values ('а');
insert into t1 values ('аа');
insert into t1 values ('ааа');
-ERROR 23000: Duplicate entry 'ааа' for key 1
+ERROR 23000: Duplicate entry 'ааа' for key 'c'
insert into t1 values ('б');
insert into t1 values ('бб');
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'ббб' for key 1
+ERROR 23000: Duplicate entry 'ббб' for key 'c'
insert into t1 values ('ꪪ');
insert into t1 values ('ꪪꪪ');
insert into t1 values ('ꪪꪪꪪ');
-ERROR 23000: Duplicate entry 'ꪪꪪ' for key 1
+ERROR 23000: Duplicate entry 'ꪪꪪ' for key 'c'
drop table t1;
create table t1 (
c char(10) character set utf8 collate utf8_bin,
@@ -574,14 +574,14 @@ t1 CREATE TABLE `t1` (
) ENGINE=MEMORY DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
-ERROR 23000: Duplicate entry 'aa' for key 1
+ERROR 23000: Duplicate entry 'aa' for key 'a'
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'a'
insert into t1 values ('б');
insert into t1 values ('бб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c;
c_all
a
@@ -610,14 +610,14 @@ t1 CREATE TABLE `t1` (
) ENGINE=MEMORY DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
-ERROR 23000: Duplicate entry 'aa' for key 1
+ERROR 23000: Duplicate entry 'aa' for key 'a'
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'a'
insert into t1 values ('б');
insert into t1 values ('бб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c;
c_all
a
@@ -640,14 +640,14 @@ unique key a (c(1))
) engine=bdb;
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
-ERROR 23000: Duplicate entry 'aa' for key 1
+ERROR 23000: Duplicate entry 'aa' for key 'a'
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'a'
insert into t1 values ('б');
insert into t1 values ('бб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c;
c_all
a
diff --git a/mysql-test/r/events.result b/mysql-test/r/events.result
index 41f944ab089..b5b1b76f1a8 100644
--- a/mysql-test/r/events.result
+++ b/mysql-test/r/events.result
@@ -15,20 +15,11 @@ create event event2 on schedule every 2 second starts now() ends date_add(now(),
drop event event2;
create event e_43 on schedule every 1 second do set @a = 5;
set global event_scheduler = 1;
-select sleep(2);
-sleep(2)
-0
alter event e_43 do alter event e_43 do set @a = 4;
-select sleep(3);
-sleep(3)
-0
select db, name, body, status, interval_field, interval_value from mysql.event;
db name body status interval_field interval_value
events_test e_43 set @a = 4 ENABLED SECOND 1
drop event e_43;
-select sleep(1);
-sleep(1)
-0
set global event_scheduler = 0;
create table t_event3 (a int, b float);
drop event if exists event3;
@@ -64,7 +55,7 @@ SHOW GRANTS;
Grants for ev_test@localhost
GRANT USAGE ON *.* TO 'ev_test'@'localhost'
GRANT ALL PRIVILEGES ON `events_test`.* TO 'ev_test'@'localhost'
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `events_test2`.* TO 'ev_test'@'localhost'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, TRIGGER ON `events_test2`.* TO 'ev_test'@'localhost'
"Here comes an error:";
SHOW EVENTS;
ERROR 42000: Access denied for user 'ev_test'@'localhost' to database 'events_test2'
@@ -121,6 +112,7 @@ drop event two_event;
drop event three_event;
drop user ev_test@localhost;
drop event one_event;
+"Sleep a bit so the server closes the second connection"
create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion
@@ -137,4 +129,68 @@ set event_scheduler=0;
ERROR HY000: Variable 'event_scheduler' is a GLOBAL variable and should be set with SET GLOBAL
set global event_scheduler=2;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
+"DISABLE the scheduler. Testing that it does not work when the variable is 0"
+set global event_scheduler=0;
+select definer, name, db from mysql.event;
+definer name db
+select get_lock("test_lock1", 20);
+get_lock("test_lock1", 20)
+1
+create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
+"Should return 1 row"
+select definer, name, db from mysql.event;
+definer name db
+root@localhost закачка events_test
+"Should be only 1 process"
+show processlist;
+Id User Host db Command Time State Info
+# root localhost events_test Query # NULL show processlist
+select release_lock("test_lock1");
+release_lock("test_lock1")
+1
+drop event закачка;
+"Should have 0 events"
+select count(*) from mysql.event;
+count(*)
+0
+"ENABLE the scheduler and get a lock"
+set global event_scheduler=1;
+select get_lock("test_lock2", 20);
+get_lock("test_lock2", 20)
+1
+"Create an event which tries to acquire a mutex. The event locks on the mutex"
+create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
+"Let some time pass to the event starts"
+"Should have only 3 processes: the scheduler, our conn and the locked event"
+show processlist;
+Id User Host db Command Time State Info
+# root localhost events_test Query # NULL show processlist
+# event_scheduler NULL Connect # Sleeping NULL
+# root events_test Connect # User lock select get_lock("test_lock2", 20)
+"Release the mutex, the event worker should finish."
+select release_lock("test_lock2");
+release_lock("test_lock2")
+1
+drop event закачка;
+set global event_scheduler=1;
+select get_lock("test_lock2_1", 20);
+get_lock("test_lock2_1", 20)
+1
+create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
+"Should see 2 processes, one locked on get_lock("
+"Shutting down the scheduler, it should wait for the running event"
+set global event_scheduler=0;
+"Should have only 3 processes: the scheduler, our conn and the locked event"
+show processlist;
+Id User Host db Command Time State Info
+# root localhost events_test Query # NULL show processlist
+"Release the lock so the child process should finish. Hence the scheduler also"
+select release_lock("test_lock2_1");
+release_lock("test_lock2_1")
+1
+"Should have only our process now:"
+show processlist;
+Id User Host db Command Time State Info
+# root localhost events_test Query # NULL show processlist
+drop event закачка21;
drop database events_test;
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 4ee95cffb00..b5084fff165 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -449,3 +449,14 @@ t1 CREATE TABLE `t1` (
FULLTEXT KEY `a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
+CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a));
+INSERT INTO t1 VALUES('test'),('test1'),('test');
+PREPARE stmt from "SELECT a, MATCH(a) AGAINST('test1 test') FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
+EXECUTE stmt;
+a MATCH(a) AGAINST('test1 test')
+test1 0.68526661396027
+EXECUTE stmt;
+a MATCH(a) AGAINST('test1 test')
+test1 0.68526661396027
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index fba274b9bb1..1507f959ae6 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -203,3 +203,18 @@ NULL
Warnings:
Error 1365 Division by 0
set sql_mode='';
+select round(111,-10);
+round(111,-10)
+0
+select round(-5000111000111000155,-1);
+round(-5000111000111000155,-1)
+-5000111000111000160
+select round(15000111000111000155,-1);
+round(15000111000111000155,-1)
+15000111000111000160
+select truncate(-5000111000111000155,-1);
+truncate(-5000111000111000155,-1)
+-5000111000111000150
+select truncate(15000111000111000155,-1);
+truncate(15000111000111000155,-1)
+15000111000111000150
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index 91579a7ea42..b1703c51f4e 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -2043,3 +2043,30 @@ c1 c2
30 8
30 9
drop table t1;
+CREATE TABLE t1 (a varchar(5), b int(11), PRIMARY KEY (a,b));
+INSERT INTO t1 VALUES ('AA',1), ('AA',2), ('AA',3), ('BB',1), ('AA',4);
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+SELECT a FROM t1 WHERE a='AA' GROUP BY a;
+a
+AA
+SELECT a FROM t1 WHERE a='BB' GROUP BY a;
+a
+BB
+EXPLAIN SELECT a FROM t1 WHERE a='AA' GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref PRIMARY PRIMARY 7 const 3 Using where; Using index
+EXPLAIN SELECT a FROM t1 WHERE a='BB' GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref PRIMARY PRIMARY 7 const 1 Using where; Using index
+SELECT DISTINCT a FROM t1 WHERE a='BB';
+a
+BB
+SELECT DISTINCT a FROM t1 WHERE a LIKE 'B%';
+a
+BB
+SELECT a FROM t1 WHERE a LIKE 'B%' GROUP BY a;
+a
+BB
+DROP TABLE t1;
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
index 379c2f83c78..e54f6d7f2a4 100644
--- a/mysql-test/r/having.result
+++ b/mysql-test/r/having.result
@@ -141,6 +141,23 @@ SUM(a)
6
4
DROP TABLE t1;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1), (2), (1), (3), (2), (1);
+SELECT a FROM t1 GROUP BY a HAVING a > 1;
+a
+2
+3
+SELECT a FROM t1 GROUP BY a HAVING 1 != 1 AND a > 1;
+a
+SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
+x a
+EXPLAIN SELECT a FROM t1 GROUP BY a HAVING 1 != 1 AND a > 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
+EXPLAIN SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
+DROP table t1;
create table t1 (col1 int, col2 varchar(5), col_t1 int);
create table t2 (col1 int, col2 varchar(5), col_t2 int);
create table t3 (col1 int, col2 varchar(5), col_t3 int);
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index 3607a2e3ab5..8fb09922eb8 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -195,7 +195,7 @@ SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL
INSERT INTO t1 VALUES (1,3);
-ERROR 23000: Duplicate entry '3' for key 1
+ERROR 23000: Duplicate entry '3' for key 'b'
DROP TABLE t1;
CREATE TABLE t1 (
a int default NULL,
@@ -384,7 +384,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const 10 Using where
alter table t1 add unique(v);
-ERROR 23000: Duplicate entry '{ ' for key 1
+ERROR 23000: Duplicate entry '{ ' for key 'v_2'
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*'));
qq
*a*a*a*
@@ -536,16 +536,16 @@ drop table t1;
create table t1 (a char(10), unique (a));
insert into t1 values ('a');
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a' for key 1
+ERROR 23000: Duplicate entry 'a' for key 'a'
alter table t1 modify a varchar(10);
insert into t1 values ('a '),('a '),('a '),('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
update t1 set a='a ' where a like 'a ';
update t1 set a='a ' where a like 'a ';
drop table t1;
@@ -607,7 +607,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where
alter table t1 add unique(v);
-ERROR 23000: Duplicate entry '{ ' for key 1
+ERROR 23000: Duplicate entry '{ ' for key 'v_2'
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*'));
qq
*a*a*a*
@@ -627,16 +627,16 @@ drop table t1;
create table t1 (a char(10), unique using btree (a)) engine=heap;
insert into t1 values ('a');
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a' for key 1
+ERROR 23000: Duplicate entry 'a' for key 'a'
alter table t1 modify a varchar(10);
insert into t1 values ('a '),('a '),('a '),('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
update t1 set a='a ' where a like 'a ';
update t1 set a='a ' where a like 'a ';
drop table t1;
@@ -699,14 +699,14 @@ ERROR 42000: Incorrect table definition; there can be only one auto column and i
create table t1 (c char(255), primary key(c(90)));
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
-ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1
+ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 'PRIMARY'
drop table t1;
CREATE TABLE t1 (a int, key(a)) engine=heap;
-insert delayed into t1 values (0);
+insert into t1 values (0);
delete from t1;
select * from t1;
a
-insert delayed into t1 values (0), (1);
+insert into t1 values (0), (1);
select * from t1 where a = 0;
a
0
diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result
index 374d2c63632..a100266978b 100644
--- a/mysql-test/r/heap_btree.result
+++ b/mysql-test/r/heap_btree.result
@@ -224,7 +224,7 @@ SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL
INSERT INTO t1 VALUES (1,3);
-ERROR 23000: Duplicate entry '3' for key 1
+ERROR 23000: Duplicate entry '3' for key 'b'
DROP TABLE t1;
CREATE TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=heap;
INSERT INTO t1 VALUES (1, NULL, NULL), (1, 1, NULL), (1, NULL, 1);
diff --git a/mysql-test/r/heap_hash.result b/mysql-test/r/heap_hash.result
index e0835bbf8d6..d4dea8b3a2e 100644
--- a/mysql-test/r/heap_hash.result
+++ b/mysql-test/r/heap_hash.result
@@ -195,7 +195,7 @@ SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL
INSERT INTO t1 VALUES (1,3);
-ERROR 23000: Duplicate entry '3' for key 1
+ERROR 23000: Duplicate entry '3' for key 'b'
DROP TABLE t1;
CREATE TABLE t1 (a int not null, primary key using HASH (a)) engine=heap;
INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
diff --git a/mysql-test/r/im_life_cycle.result b/mysql-test/r/im_life_cycle.result
index f8eaf0ccb46..70aef9c40d5 100644
--- a/mysql-test/r/im_life_cycle.result
+++ b/mysql-test/r/im_life_cycle.result
@@ -3,22 +3,22 @@ instance_name status
mysqld1 online
mysqld2 offline
SHOW INSTANCE STATUS mysqld1;
-instance_name status version
-mysqld1 online VERSION
+instance_name status version_number version
+mysqld1 online VERSION_NUMBER VERSION
SHOW INSTANCE STATUS mysqld2;
-instance_name status version
-mysqld2 offline VERSION
+instance_name status version_number version
+mysqld2 offline VERSION_NUMBER VERSION
START INSTANCE mysqld2;
SHOW INSTANCES;
instance_name status
mysqld1 online
mysqld2 online
SHOW INSTANCE STATUS mysqld1;
-instance_name status version
-mysqld1 online VERSION
+instance_name status version_number version
+mysqld1 online VERSION_NUMBER VERSION
SHOW INSTANCE STATUS mysqld2;
-instance_name status version
-mysqld2 online VERSION
+instance_name status version_number version
+mysqld2 online VERSION_NUMBER VERSION
SHOW VARIABLES LIKE 'port';
Variable_name Value
port IM_MYSQLD1_PORT
@@ -28,11 +28,11 @@ instance_name status
mysqld1 online
mysqld2 offline
SHOW INSTANCE STATUS mysqld1;
-instance_name status version
-mysqld1 online VERSION
+instance_name status version_number version
+mysqld1 online VERSION_NUMBER VERSION
SHOW INSTANCE STATUS mysqld2;
-instance_name status version
-mysqld2 offline VERSION
+instance_name status version_number version
+mysqld2 offline VERSION_NUMBER VERSION
START INSTANCE mysqld3;
ERROR HY000: Bad instance name. Check that the instance with such a name exists
START INSTANCE mysqld1;
@@ -62,3 +62,5 @@ SHOW INSTANCES;
instance_name status
mysqld1 online
mysqld2 offline
+SHOW INSTANCE STATUS;
+ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
diff --git a/mysql-test/r/im_utils.result b/mysql-test/r/im_utils.result
index e204affc8ec..504b2efe4af 100644
--- a/mysql-test/r/im_utils.result
+++ b/mysql-test/r/im_utils.result
@@ -21,7 +21,7 @@ skip-stack-trace VALUE
skip-innodb VALUE
skip-bdb VALUE
skip-ndbcluster VALUE
-old-log-format VALUE
+log-output VALUE
SHOW INSTANCE OPTIONS mysqld2;
option_name value
instance_name VALUE
@@ -42,7 +42,7 @@ skip-stack-trace VALUE
skip-innodb VALUE
skip-bdb VALUE
skip-ndbcluster VALUE
-old-log-format VALUE
+log-output VALUE
START INSTANCE mysqld2;
STOP INSTANCE mysqld2;
SHOW mysqld1 LOG FILES;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 577e6a7192a..90dc859f854 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -234,7 +234,7 @@ n after commit
commit;
insert into t1 values (5);
insert into t1 values (4);
-ERROR 23000: Duplicate entry '4' for key 1
+ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
commit;
select n, "after commit" from t1;
n after commit
@@ -243,7 +243,7 @@ n after commit
set autocommit=1;
insert into t1 values (6);
insert into t1 values (4);
-ERROR 23000: Duplicate entry '4' for key 1
+ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
select n from t1;
n
4
@@ -318,7 +318,7 @@ drop table t1;
CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb;
insert into t1 values ('pippo', 12);
insert into t1 values ('pippo', 12);
-ERROR 23000: Duplicate entry 'pippo' for key 1
+ERROR 23000: Duplicate entry 'pippo' for key 'PRIMARY'
delete from t1;
delete from t1 where id = 'pippo';
select * from t1;
@@ -482,9 +482,9 @@ UNIQUE ggid (ggid)
insert into t1 (ggid,passwd) values ('test1','xxx');
insert into t1 (ggid,passwd) values ('test2','yyy');
insert into t1 (ggid,passwd) values ('test2','this will fail');
-ERROR 23000: Duplicate entry 'test2' for key 2
+ERROR 23000: Duplicate entry 'test2' for key 'ggid'
insert into t1 (ggid,id) values ('this will fail',1);
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t1 where ggid='test1';
id ggid email passwd
1 test1 xxx
@@ -497,7 +497,7 @@ id ggid email passwd
replace into t1 (ggid,id) values ('this will work',1);
replace into t1 (ggid,passwd) values ('test2','this will work');
update t1 set id=100,ggid='test2' where id=1;
-ERROR 23000: Duplicate entry 'test2' for key 2
+ERROR 23000: Duplicate entry 'test2' for key 'ggid'
select * from t1;
id ggid email passwd
1 this will work
@@ -816,7 +816,7 @@ create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(3
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-ERROR 23000: Duplicate entry '1-1' for key 1
+ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
select id from t1;
id
0
@@ -834,7 +834,7 @@ insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJ
LOCK TABLES t1 WRITE;
begin;
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-ERROR 23000: Duplicate entry '1-1' for key 1
+ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
select id from t1;
id
0
@@ -1964,7 +1964,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where; Using index
alter table t1 add unique(v);
-ERROR 23000: Duplicate entry '{ ' for key 1
+ERROR 23000: Duplicate entry '{ ' for key 'v_2'
alter table t1 add key(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
qq
@@ -2324,16 +2324,16 @@ drop table t1;
create table t1 (a char(10), unique (a));
insert into t1 values ('a ');
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a' for key 1
+ERROR 23000: Duplicate entry 'a' for key 'a'
alter table t1 modify a varchar(10);
insert into t1 values ('a '),('a '),('a '),('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
update t1 set a='a ' where a like 'a%';
select concat(a,'.') from t1;
concat(a,'.')
@@ -2456,7 +2456,7 @@ key (rowid), unique(val)) engine=innodb;
replace into t1 (val) values ('1'),('2');
replace into t1 (val) values ('1'),('2');
insert into t1 (val) values ('1'),('2');
-ERROR 23000: Duplicate entry '1' for key 2
+ERROR 23000: Duplicate entry '1' for key 'val'
select * from t1;
rowid val
3 1
@@ -2466,7 +2466,7 @@ create table t1 (a int not null auto_increment primary key, val int) engine=Inno
insert into t1 (val) values (1);
update t1 set a=2 where a=1;
insert into t1 (val) values (1);
-ERROR 23000: Duplicate entry '2' for key 1
+ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
select * from t1;
a val
2 1
@@ -2758,3 +2758,21 @@ e varchar(255) character set utf8,
key (a,b,c,d,e)) engine=innodb;
ERROR 42000: Specified key was too long; max key length is 3072 bytes
End of 5.0 tests
+CREATE TABLE t1 (
+field1 varchar(8) NOT NULL DEFAULT '',
+field2 varchar(8) NOT NULL DEFAULT '',
+PRIMARY KEY (field1, field2)
+) ENGINE=InnoDB;
+CREATE TABLE t2 (
+field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY,
+FOREIGN KEY (field1) REFERENCES t1 (field1)
+ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('old', 'somevalu');
+INSERT INTO t1 VALUES ('other', 'anyvalue');
+INSERT INTO t2 VALUES ('old');
+INSERT INTO t2 VALUES ('other');
+UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
+ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 1 would lead to a duplicate entry
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/mysql-test/r/innodb_cache.result b/mysql-test/r/innodb_cache.result
index 5e8611655a2..5c494814df9 100644
--- a/mysql-test/r/innodb_cache.result
+++ b/mysql-test/r/innodb_cache.result
@@ -121,7 +121,7 @@ id a
begin;
insert into t3 VALUES ( NULL, 1, 1, 2 );
insert into t3 VALUES ( NULL, 1, 1, 2 );
-ERROR 23000: Duplicate entry '1-1' for key 2
+ERROR 23000: Duplicate entry '1-1' for key 't1_id'
commit;
select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t2_id = t2.id and t1.id = 1 order by t1.a asc;
id a
diff --git a/mysql-test/r/innodb_concurrent.result b/mysql-test/r/innodb_concurrent.result
index 8e9d2e2ffe6..56adb812cb7 100644
--- a/mysql-test/r/innodb_concurrent.result
+++ b/mysql-test/r/innodb_concurrent.result
@@ -1,7 +1,7 @@
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
-create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) ENGINE=innodb;
Warnings:
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
@@ -106,7 +106,7 @@ eta tipo c
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
drop table t1;
-create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) ENGINE=innodb;
Warnings:
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
@@ -239,7 +239,7 @@ a b
1 1
commit;
drop table t1;
-create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) ENGINE=innodb;
Warnings:
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
@@ -323,7 +323,7 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
drop table t1;
-create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) ENGINE=innodb;
Warnings:
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
@@ -407,7 +407,7 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
drop table t1;
-create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) ENGINE=innodb;
Warnings:
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
@@ -478,7 +478,7 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
drop table t1;
-create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) ENGINE=innodb;
Warnings:
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
@@ -549,7 +549,7 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
drop table t1;
-create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) ENGINE=innodb;
Warnings:
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index fa8c3f8a2b8..772179d758a 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -4,7 +4,7 @@ insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,
create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY);
insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1;
insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
-ERROR 23000: Duplicate entry '16' for key 1
+ERROR 23000: Duplicate entry '16' for key 'PRIMARY'
insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1;
select * from t2;
payoutID
@@ -561,7 +561,7 @@ create table t2 (a int not null, b char(10));
insert into t1 values (1,"t1:1"),(3,"t1:3");
insert into t2 values (2,"t2:2"), (3,"t2:3");
insert into t1 select * from t2;
-ERROR 23000: Duplicate entry '3' for key 1
+ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
select * from t1;
a b
1 t1:1
diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result
index dbe5d600a95..aeaa2b66ec7 100644
--- a/mysql-test/r/insert_update.result
+++ b/mysql-test/r/insert_update.result
@@ -26,7 +26,7 @@ a b c
3 4 1020
5 6 130
INSERT t1 VALUES (1,9,70) ON DUPLICATE KEY UPDATE c=c+100000, b=4;
-ERROR 23000: Duplicate entry '4' for key 2
+ERROR 23000: Duplicate entry '4' for key 'b'
SELECT * FROM t1;
a b c
1 2 10010
@@ -132,7 +132,7 @@ a b c
3 4 1020
5 6 130
INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4;
-ERROR 23000: Duplicate entry '4' for key 2
+ERROR 23000: Duplicate entry '4' for key 'b'
SELECT * FROM t1;
a b c
1 2 10010
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index bd725d9ac84..9d6c6140dd5 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -169,7 +169,7 @@ usr_id uniq_id increment usr2_id c_amount max
3 4 84676 NULL NULL NULL
INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
-ERROR 23000: Duplicate entry '2-3' for key 1
+ERROR 23000: Duplicate entry '2-3' for key 'PRIMARY'
INSERT INTO t2 VALUES (7,3,1000,2000,0,0,746294,937484,'yes');
SELECT t1.usr_id,t1.uniq_id,t1.increment,t2.usr2_id,t2.c_amount,t2.max FROM t1 LEFT JOIN t2 ON t2.id = t1.uniq_id WHERE t1.uniq_id = 4 ORDER BY t2.c_amount;
usr_id uniq_id increment usr2_id c_amount max
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index 75676507760..5d62f8d61d6 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -127,7 +127,7 @@ primary key (SEQNO, MOTYPEID, MOINSTANCEID, ATTRID, VALUE )
INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
INSERT INTO t1 VALUES (1, 1, 1, 1, 'b');
INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
-ERROR 23000: Duplicate entry '1-1-1-1-a' for key 1
+ERROR 23000: Duplicate entry '1-1-1-1-a' for key 'PRIMARY'
drop table t1;
CREATE TABLE t1 (
a tinytext NOT NULL,
@@ -251,13 +251,13 @@ insert t1 values ('cccc', 'tttt'),
(0xD0B1212223D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1212223D0B1D0B1D0B1D0B1),
(0xD0B1222123D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1222123D0B1D0B1D0B1D0B1);
insert t1 (c) values ('cc22');
-ERROR 23000: Duplicate entry 'cc22' for key 1
+ERROR 23000: Duplicate entry 'cc22' for key 'c'
insert t1 (t) values ('ttt22');
-ERROR 23000: Duplicate entry 'ttt22' for key 2
+ERROR 23000: Duplicate entry 'ttt22' for key 't'
insert t1 (c) values (0xD0B1212322D0B1D0B1D0B1D0B1D0B1);
-ERROR 23000: Duplicate entry 'б!#"' for key 1
+ERROR 23000: Duplicate entry 'б!#"' for key 'c'
insert t1 (t) values (0xD0B1D0B1212322D0B1D0B1D0B1D0B1);
-ERROR 23000: Duplicate entry 'бб!#"б' for key 2
+ERROR 23000: Duplicate entry 'бб!#"б' for key 't'
select c from t1 where c='cccc';
c
cccc
@@ -462,5 +462,5 @@ insert into t1 values(1, 'a', 'a', NULL);
insert into t1 values(1, 'b', 'b', NULL);
alter table t1 drop index i3, drop index i2, drop index i1;
alter table t1 add index i3 (c3), add index i2 (c2), add unique index i1 (c1);
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'i1'
drop table t1;
diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result
index 2cb90679aed..e9d41c104dd 100644
--- a/mysql-test/r/kill.result
+++ b/mysql-test/r/kill.result
@@ -25,7 +25,7 @@ select ((@id := kill_id) - kill_id) from t3;
((@id := kill_id) - kill_id)
0
kill @id;
-ERROR 08S01: Server shutdown in progress
+Got one of the listed errors
drop table t1, t2, t3;
select get_lock("a", 10);
get_lock("a", 10)
diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result
index caaf0367bb7..f75cf503938 100644
--- a/mysql-test/r/log_tables.result
+++ b/mysql-test/r/log_tables.result
@@ -52,3 +52,15 @@ select "Mark that we woke up from TRUNCATE in the test"
as "test passed";
test passed
Mark that we woke up from TRUNCATE in the test
+use test;
+truncate table mysql.general_log;
+set names utf8;
+create table bug16905 (s char(15) character set utf8 default 'пусто');
+insert into bug16905 values ('новое');
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP root[root] @ localhost [] 2 1 Query set names utf8
+TIMESTAMP root[root] @ localhost [] 2 1 Query create table bug16905 (s char(15) character set utf8 default 'пусто')
+TIMESTAMP root[root] @ localhost [] 2 1 Query insert into bug16905 values ('новое')
+TIMESTAMP root[root] @ localhost [] 2 1 Query select * from mysql.general_log
+drop table bug16905;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index 437b001070a..85082d606a7 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -548,9 +548,9 @@ select * from t4 where a+0 > 90;
a b
99 1
insert t5 values (1,1);
-ERROR 23000: Duplicate entry '1-1' for key 1
+ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
insert t6 values (2,1);
-ERROR 23000: Duplicate entry '2-1' for key 1
+ERROR 23000: Duplicate entry '2-1' for key 'PRIMARY'
insert t5 values (1,1) on duplicate key update b=b+10;
insert t6 values (2,1) on duplicate key update b=b+20;
select * from t5 where a < 3;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index f60996ba31f..06e1872a1c0 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -469,9 +469,9 @@ b.
c.
update t1 set b='b ' where a=2;
update t1 set b='b ' where a > 1;
-ERROR 23000: Duplicate entry 'b ' for key 2
+ERROR 23000: Duplicate entry 'b ' for key 'b'
insert into t1 (b) values ('b');
-ERROR 23000: Duplicate entry 'b' for key 2
+ERROR 23000: Duplicate entry 'b' for key 'b'
select * from t1;
a b
1 a
@@ -867,7 +867,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where; Using index
alter table t1 add unique(v);
-ERROR 23000: Duplicate entry '{ ' for key 1
+ERROR 23000: Duplicate entry '{ ' for key 'v_2'
alter table t1 add key(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
qq
@@ -1227,16 +1227,16 @@ drop table t1;
create table t1 (a char(10), unique (a));
insert into t1 values ('a ');
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a' for key 1
+ERROR 23000: Duplicate entry 'a' for key 'a'
alter table t1 modify a varchar(10);
insert into t1 values ('a '),('a '),('a '),('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
update t1 set a='a ' where a like 'a%';
select concat(a,'.') from t1;
concat(a,'.')
diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result
index 1e863c9012f..462d738a8bb 100644
--- a/mysql-test/r/ndb_basic.result
+++ b/mysql-test/r/ndb_basic.result
@@ -678,6 +678,61 @@ CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
select * from t1;
b
drop table t1;
+create table t1 (a int) engine=ndb;
+create table t2 (a int) engine=ndb;
+insert into t1 values (1);
+insert into t2 values (1);
+delete t1.* from t1, t2 where t1.a = t2.a;
+select * from t1;
+a
+select * from t2;
+a
+1
+drop table t1;
+drop table t2;
+CREATE TABLE t1 (
+i INT,
+j INT,
+x INT,
+y INT,
+z INT
+) engine=ndb;
+CREATE TABLE t2 (
+i INT,
+k INT,
+x INT,
+y INT,
+z INT
+) engine=ndb;
+CREATE TABLE t3 (
+j INT,
+k INT,
+x INT,
+y INT,
+z INT
+) engine=ndb;
+INSERT INTO t1 VALUES ( 1, 2,13,14,15);
+INSERT INTO t2 VALUES ( 1, 3,23,24,25);
+INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
+UPDATE t1 AS a
+INNER JOIN t2 AS b
+ON a.i = b.i
+INNER JOIN t3 AS c
+ON a.j = c.j AND b.k = c.k
+SET a.x = b.x,
+a.y = b.y,
+a.z = (
+SELECT sum(z)
+FROM t3
+WHERE y = 34
+)
+WHERE b.x = 23;
+select * from t1;
+i j x y z
+1 2 23 24 71
+drop table t1;
+drop table t2;
+drop table t3;
create table atablewithareallylongandirritatingname (a int);
insert into atablewithareallylongandirritatingname values (2);
select * from atablewithareallylongandirritatingname;
diff --git a/mysql-test/r/ndb_blob.result b/mysql-test/r/ndb_blob.result
index f28cb865962..9c76d46f4f0 100644
--- a/mysql-test/r/ndb_blob.result
+++ b/mysql-test/r/ndb_blob.result
@@ -428,6 +428,13 @@ delete from t1;
select * from t1;
a b
commit;
+replace t1 set a=2, b='y';
+select * from t1;
+a b
+2 y
+delete from t1;
+select * from t1;
+a b
drop table t1;
set autocommit=0;
create table t1 (
diff --git a/mysql-test/r/ndb_charset.result b/mysql-test/r/ndb_charset.result
index b1f8190f0ca..b3a2112d50b 100644
--- a/mysql-test/r/ndb_charset.result
+++ b/mysql-test/r/ndb_charset.result
@@ -27,9 +27,9 @@ a char(3) character set latin1 collate latin1_swedish_ci primary key
) engine=ndb;
insert into t1 values('aAa');
insert into t1 values('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'PRIMARY'
insert into t1 values('AAA');
-ERROR 23000: Duplicate entry 'AAA' for key 1
+ERROR 23000: Duplicate entry 'AAA' for key 'PRIMARY'
select * from t1 order by a;
a
aAa
@@ -51,9 +51,9 @@ a varchar(20) character set latin1 collate latin1_swedish_ci primary key
) engine=ndb;
insert into t1 values ('A'),('b '),('C '),('d '),('E'),('f');
insert into t1 values('b');
-ERROR 23000: Duplicate entry 'b' for key 1
+ERROR 23000: Duplicate entry 'b' for key 'PRIMARY'
insert into t1 values('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'PRIMARY'
select a,length(a) from t1 order by a;
a length(a)
A 1
@@ -112,9 +112,9 @@ unique key(a)
) engine=ndb;
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
-ERROR 23000: Duplicate entry '2' for key 1
+ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
insert into t1 values(3, 'AAA');
-ERROR 23000: Duplicate entry '3' for key 1
+ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
select * from t1 order by p;
p a
1 aAa
@@ -138,9 +138,9 @@ unique key(a)
) engine=ndb;
insert into t1 values (1,'A'),(2,'b '),(3,'C '),(4,'d '),(5,'E'),(6,'f');
insert into t1 values(99,'b');
-ERROR 23000: Duplicate entry '99' for key 1
+ERROR 23000: Duplicate entry '99' for key 'PRIMARY'
insert into t1 values(99,'a ');
-ERROR 23000: Duplicate entry '99' for key 1
+ERROR 23000: Duplicate entry '99' for key 'PRIMARY'
select a,length(a) from t1 order by a;
a length(a)
A 1
diff --git a/mysql-test/r/ndb_index_unique.result b/mysql-test/r/ndb_index_unique.result
index 1401ae26ddb..1085d15ec30 100644
--- a/mysql-test/r/ndb_index_unique.result
+++ b/mysql-test/r/ndb_index_unique.result
@@ -22,7 +22,7 @@ select * from t1 where b = 4 order by a;
a b c
3 4 6
insert into t1 values(8, 2, 3);
-ERROR 23000: Duplicate entry '8' for key 1
+ERROR 23000: Duplicate entry '8' for key 'PRIMARY'
select * from t1 order by a;
a b c
1 2 3
@@ -89,7 +89,7 @@ a b c
1 1 1
4 4 NULL
insert into t1 values(5,1,1);
-ERROR 23000: Duplicate entry '5' for key 1
+ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
drop table t1;
CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
@@ -112,7 +112,7 @@ select * from t2 where b = 4 order by a;
a b c
3 4 6
insert into t2 values(8, 2, 3);
-ERROR 23000: Duplicate entry '8' for key 1
+ERROR 23000: Duplicate entry '8' for key 'PRIMARY'
select * from t2 order by a;
a b c
1 2 3
@@ -177,7 +177,7 @@ pk a
3 NULL
4 4
insert into t1 values (5,0);
-ERROR 23000: Duplicate entry '5' for key 1
+ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
select * from t1 order by pk;
pk a
-1 NULL
@@ -210,7 +210,7 @@ pk a b c
0 NULL 18 NULL
1 3 19 abc
insert into t2 values(2,3,19,'abc');
-ERROR 23000: Duplicate entry '2' for key 1
+ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
select * from t2 order by pk;
pk a b c
-1 1 17 NULL
@@ -626,3 +626,12 @@ select * from t1 where code = '12' and month = 4 and year = 2004 ;
id month year code
1 4 2004 12
drop table t1;
+create table t1 (a int primary key, b varchar(1000) not null, unique key (b))
+engine=ndb charset=utf8;
+insert into t1 values (1, repeat(_utf8 0xe288ab6474, 200));
+insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200));
+ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
+select a, sha1(b) from t1;
+a sha1(b)
+1 08f5d02c8b8bc244f275bdfc22c42c5cab0d9d7d
+drop table t1;
diff --git a/mysql-test/r/ndb_insert.result b/mysql-test/r/ndb_insert.result
index 50739ca15da..11d322a06de 100644
--- a/mysql-test/r/ndb_insert.result
+++ b/mysql-test/r/ndb_insert.result
@@ -417,7 +417,7 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
2000
INSERT INTO t1 VALUES (1,1,1);
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
diff --git a/mysql-test/r/ndb_replace.result b/mysql-test/r/ndb_replace.result
index 63fd8b55c8e..6aa1a387661 100644
--- a/mysql-test/r/ndb_replace.result
+++ b/mysql-test/r/ndb_replace.result
@@ -11,7 +11,7 @@ insert into t1 (gesuchnr, benutzer_id) value (3,2);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
insert into t1 (gesuchnr,benutzer_id) values (1,1);
-ERROR 23000: Duplicate entry '1-1' for key 1
+ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
replace into t1 (gesuchnr,benutzer_id) values (1,1);
select * from t1 order by gesuchnr;
gesuchnr benutzer_id
diff --git a/mysql-test/r/ndb_update.result b/mysql-test/r/ndb_update.result
index c2247564e65..ea6eb1644f2 100644
--- a/mysql-test/r/ndb_update.result
+++ b/mysql-test/r/ndb_update.result
@@ -18,7 +18,7 @@ pk1 b c
2 2 2
4 1 1
UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4;
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t1 order by pk1;
pk1 b c
0 0 0
diff --git a/mysql-test/r/ndb_view.result b/mysql-test/r/ndb_view.result
new file mode 100644
index 00000000000..b7d1b6860c8
--- /dev/null
+++ b/mysql-test/r/ndb_view.result
@@ -0,0 +1,24 @@
+DROP TABLE IF EXISTS t1,t2,t3;
+DROP VIEW IF EXISTS v1,v2,v3;
+create table t1 (a int, b int, c int, d int) engine=ndb;
+insert into t1 values (1,2,3,4),(5,6,7,8);
+create view v1 as select t1.c as a, t1.a as b, t1.d as c, t1.a+t1.b+t1.c as d from t1;
+select * from v1 order by a,b,c;
+a b c d
+3 1 4 6
+7 5 8 18
+update v1 set a=a+100 where b=1;
+select * from v1 order by a,b,c;
+a b c d
+7 5 8 18
+103 1 4 106
+drop view v1;
+create view v1 as select t1.c as a from t1;
+insert into v1 values (200);
+select * from t1 order by a,b,c,d;
+a b c d
+NULL NULL 200 NULL
+1 2 103 4
+5 6 7 8
+drop view v1;
+drop table t1;
diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
index 0fef8922f43..b5560a4757c 100644
--- a/mysql-test/r/ps_2myisam.result
+++ b/mysql-test/r/ps_2myisam.result
@@ -1426,7 +1426,7 @@ select a,b from t1 where b = @arg00;
a b
6 six
execute stmt1 using @arg00;
-ERROR 23000: Duplicate entry '6' for key 1
+ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
set @arg00=NULL ;
prepare stmt1 from 'insert into t1 values(0, ? )';
execute stmt1 using @arg00;
@@ -1539,7 +1539,7 @@ a b
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
-ERROR 23000: Duplicate entry '82' for key 1
+ERROR 23000: Duplicate entry '82' for key 'PRIMARY'
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'MYISAM' ;
diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
index 5f979a124e1..594e673ba4d 100644
--- a/mysql-test/r/ps_3innodb.result
+++ b/mysql-test/r/ps_3innodb.result
@@ -1409,7 +1409,7 @@ select a,b from t1 where b = @arg00;
a b
6 six
execute stmt1 using @arg00;
-ERROR 23000: Duplicate entry '6' for key 1
+ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
set @arg00=NULL ;
prepare stmt1 from 'insert into t1 values(0, ? )';
execute stmt1 using @arg00;
@@ -1522,7 +1522,7 @@ a b
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
-ERROR 23000: Duplicate entry '82' for key 1
+ERROR 23000: Duplicate entry '82' for key 'PRIMARY'
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'InnoDB' ;
diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result
index 021db900e86..fb94ed7ca34 100644
--- a/mysql-test/r/ps_4heap.result
+++ b/mysql-test/r/ps_4heap.result
@@ -1410,7 +1410,7 @@ select a,b from t1 where b = @arg00;
a b
6 six
execute stmt1 using @arg00;
-ERROR 23000: Duplicate entry '6' for key 1
+ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
set @arg00=NULL ;
prepare stmt1 from 'insert into t1 values(0, ? )';
execute stmt1 using @arg00;
@@ -1523,7 +1523,7 @@ a b
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
-ERROR 23000: Duplicate entry '82' for key 1
+ERROR 23000: Duplicate entry '82' for key 'PRIMARY'
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'HEAP' ;
diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
index f1444df4888..3a630b58b8a 100644
--- a/mysql-test/r/ps_5merge.result
+++ b/mysql-test/r/ps_5merge.result
@@ -1452,7 +1452,7 @@ select a,b from t1 where b = @arg00;
a b
6 six
execute stmt1 using @arg00;
-ERROR 23000: Duplicate entry '6' for key 1
+ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
set @arg00=NULL ;
prepare stmt1 from 'insert into t1 values(0, ? )';
execute stmt1 using @arg00;
@@ -1565,7 +1565,7 @@ a b
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
-ERROR 23000: Duplicate entry '82' for key 1
+ERROR 23000: Duplicate entry '82' for key 'PRIMARY'
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'MYISAM' ;
@@ -4466,7 +4466,7 @@ select a,b from t1 where b = @arg00;
a b
6 six
execute stmt1 using @arg00;
-ERROR 23000: Duplicate entry '6' for key 1
+ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
set @arg00=NULL ;
prepare stmt1 from 'insert into t1 values(0, ? )';
execute stmt1 using @arg00;
@@ -4579,7 +4579,7 @@ a b
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
-ERROR 23000: Duplicate entry '82' for key 1
+ERROR 23000: Duplicate entry '82' for key 'PRIMARY'
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'MYISAM' ;
diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result
index f83a5b090f4..581369a3faa 100644
--- a/mysql-test/r/ps_6bdb.result
+++ b/mysql-test/r/ps_6bdb.result
@@ -1409,7 +1409,7 @@ select a,b from t1 where b = @arg00;
a b
6 six
execute stmt1 using @arg00;
-ERROR 23000: Duplicate entry '6' for key 1
+ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
set @arg00=NULL ;
prepare stmt1 from 'insert into t1 values(0, ? )';
execute stmt1 using @arg00;
@@ -1522,7 +1522,7 @@ a b
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
-ERROR 23000: Duplicate entry '82' for key 1
+ERROR 23000: Duplicate entry '82' for key 'PRIMARY'
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'BDB' ;
diff --git a/mysql-test/r/replace.result b/mysql-test/r/replace.result
index a7d59fcfa62..ca32b3d45bf 100644
--- a/mysql-test/r/replace.result
+++ b/mysql-test/r/replace.result
@@ -13,9 +13,9 @@ drop table t1;
create table t1 (a tinyint not null auto_increment primary key, b char(20) default "default_value");
insert into t1 values (126,"first"),(63, "middle"),(0,"last");
insert into t1 values (0,"error");
-ERROR 23000: Duplicate entry '127' for key 1
+ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
replace into t1 values (0,"error");
-ERROR 23000: Duplicate entry '127' for key 1
+ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
replace into t1 values (126,"first updated");
replace into t1 values (63,default);
select * from t1;
diff --git a/mysql-test/r/rpl_auto_increment.result b/mysql-test/r/rpl_auto_increment.result
index 9eca51ad2d9..9984ccf51f3 100644
--- a/mysql-test/r/rpl_auto_increment.result
+++ b/mysql-test/r/rpl_auto_increment.result
@@ -126,7 +126,7 @@ a
504
set @@insert_id=600;
insert into t1 values(600),(NULL),(NULL);
-ERROR 23000: Duplicate entry '600' for key 1
+ERROR 23000: Duplicate entry '600' for key 'PRIMARY'
set @@insert_id=600;
insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
select * from t1;
diff --git a/mysql-test/r/rpl_heap.result b/mysql-test/r/rpl_heap.result
index 1facbcb7676..d0ef7e541b2 100644
--- a/mysql-test/r/rpl_heap.result
+++ b/mysql-test/r/rpl_heap.result
@@ -1,10 +1,10 @@
reset master;
drop table if exists t1;
-create table t1 type=HEAP select 10 as a;
+create table t1 ENGINE=HEAP select 10 as a;
insert into t1 values(11);
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use `test`; create table t1 type=HEAP select 10 as a
+master-bin.001 79 Query 1 79 use `test`; create table t1 ENGINE=HEAP select 10 as a
master-bin.001 154 Query 1 154 use `test`; insert into t1 values(11)
reset slave;
start slave;
@@ -12,7 +12,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(2) NOT NULL default '0'
-) TYPE=HEAP
+) ENGINE=HEAP
select * from t1;
a
10
diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result
index 03c370d2dd7..47e056429ce 100644
--- a/mysql-test/r/rpl_loaddata.result
+++ b/mysql-test/r/rpl_loaddata.result
@@ -61,7 +61,7 @@ unique(day)) engine=MyISAM;
load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
-ERROR 23000: Duplicate entry '2003-03-22' for key 1
+ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
select * from t2;
day id category name
2003-02-22 2461 b a a a @ % ' " a
@@ -76,6 +76,6 @@ delete from t2;
load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
-ERROR 23000: Duplicate entry '2003-03-22' for key 1
+ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
drop table t2;
drop table t2;
diff --git a/mysql-test/r/rpl_ndb_sync.result b/mysql-test/r/rpl_ndb_sync.result
index 44d0efa7e5a..e17c9b99e12 100644
--- a/mysql-test/r/rpl_ndb_sync.result
+++ b/mysql-test/r/rpl_ndb_sync.result
@@ -25,8 +25,7 @@ hex(c2) hex(c3) c1
0 1 BCDEF
1 0 CD
0 0 DEFGHIJKL
-CREATE TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT);
-DELETE FROM cluster_replication.backup_info;
+CREATE TEMPORARY TABLE cluster_replication.backup_info (id INT, backup_id INT) ENGINE=HEAP;
LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info;
@the_backup_id:=backup_id
diff --git a/mysql-test/r/rpl_row_UUID.result b/mysql-test/r/rpl_row_UUID.result
index 06c81e28ef6..36aa3c625bb 100644
--- a/mysql-test/r/rpl_row_UUID.result
+++ b/mysql-test/r/rpl_row_UUID.result
@@ -35,4 +35,6 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP PROCEDURE test.p1;
+DROP FUNCTION test.fn1;
DROP TABLE test.t1;
+DROP TABLE test.t2;
diff --git a/mysql-test/r/rpl_row_basic_7ndb.result b/mysql-test/r/rpl_row_basic_7ndb.result
index 634d5b2b5d5..ccf94a02ed8 100644
--- a/mysql-test/r/rpl_row_basic_7ndb.result
+++ b/mysql-test/r/rpl_row_basic_7ndb.result
@@ -392,11 +392,11 @@ DROP TABLE t7;
CREATE TABLE t7 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'NDB' ;
INSERT INTO t7 VALUES (99,99,99);
INSERT INTO t7 VALUES (99,22,33);
-ERROR 23000: Duplicate entry '99' for key 1
+ERROR 23000: Duplicate entry '99' for key 'PRIMARY'
INSERT INTO t7 VALUES (11,99,33);
-ERROR 23000: Duplicate entry '11' for key 1
+ERROR 23000: Duplicate entry '11' for key 'PRIMARY'
INSERT INTO t7 VALUES (11,22,99);
-ERROR 23000: Duplicate entry '11' for key 1
+ERROR 23000: Duplicate entry '11' for key 'PRIMARY'
SELECT * FROM t7 ORDER BY a;
a b c
99 99 99
diff --git a/mysql-test/r/rpl_row_trig001.result b/mysql-test/r/rpl_row_trig001.result
index dcbb05e4ab4..6665dc6d555 100644
--- a/mysql-test/r/rpl_row_trig001.result
+++ b/mysql-test/r/rpl_row_trig001.result
@@ -22,6 +22,7 @@ END//
-----------------------------------
DROP PROCEDURE test.p2;
+DROP PROCEDURE test.p3;
DROP TRIGGER test.t2_ai;
DROP TRIGGER test.t3_bi_t2;
DROP TABLE test.t1;
diff --git a/mysql-test/r/rpl_stm_EE_err2.result b/mysql-test/r/rpl_stm_EE_err2.result
index fa1ce0ae0e6..13aa45d8ced 100644
--- a/mysql-test/r/rpl_stm_EE_err2.result
+++ b/mysql-test/r/rpl_stm_EE_err2.result
@@ -9,5 +9,5 @@ set sql_log_bin=0;
insert into t1 values(2);
set sql_log_bin=1;
insert into t1 values(1),(2);
-ERROR 23000: Duplicate entry '2' for key 1
+ERROR 23000: Duplicate entry '2' for key 'a'
drop table t1;
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 960c389eee2..38dba8019a5 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -32,7 +32,7 @@ t1 0 PRIMARY 1 a A 5 NULL NULL BTREE
t1 1 b 1 b A 1 NULL NULL BTREE
t1 1 b 2 c A 5 NULL NULL BTREE
insert into t1 values (5,5,5);
-ERROR 23000: Duplicate entry '5' for key 1
+ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result
index bb0adae6bab..4156b351281 100644
--- a/mysql-test/r/sp-code.result
+++ b/mysql-test/r/sp-code.result
@@ -172,7 +172,7 @@ Pos Instruction
17 set v_col@8 NULL
18 stmt 0 "select row,col into v_row,v_col from ..."
19 stmt 0 "select dig into v_dig from sudoku_wor..."
-20 set_case_expr 0 v_dig@4
+20 set_case_expr (34) 0 v_dig@4
21 jump_if_not 25(34) (case_expr@0 = 0)
22 set v_dig@4 1
23 stmt 4 "update sudoku_work set dig = 1 where ..."
diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result
index 1b720be9403..4df8086c84e 100644
--- a/mysql-test/r/sp-destruct.result
+++ b/mysql-test/r/sp-destruct.result
@@ -72,6 +72,12 @@ drop trigger t1_ai;
create trigger t1_ai after insert on t1 for each row call bug14233_3();
insert into t1 values (0);
ERROR HY000: Failed to load routine test.bug14233_3. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6)
-delete from mysql.proc where name like 'bug14233%';
drop trigger t1_ai;
drop table t1;
+drop function bug14233_1;
+drop function bug14233_2;
+drop procedure bug14233_3;
+show procedure status;
+Db Name Type Definer Modified Created Security_type Comment
+show function status;
+Db Name Type Definer Modified Created Security_type Comment
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index 885b7827370..fc29f915b82 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -425,7 +425,7 @@ set y = x;
end|
set @x = 0|
call bug3279(@x)|
-ERROR 23000: Duplicate entry '6' for key 1
+ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
select @x|
@x
0
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 761d4b83a39..5961c71223a 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -3410,7 +3410,7 @@ begin
select bug12379();
end|
select bug12379()|
-ERROR 23000: Duplicate entry 'X' for key 1
+ERROR 23000: Duplicate entry 'X' for key 'PRIMARY'
select 1|
1
1
@@ -3427,7 +3427,7 @@ select 3|
3
3
call bug12379_3()|
-ERROR 23000: Duplicate entry 'X' for key 1
+ERROR 23000: Duplicate entry 'X' for key 'PRIMARY'
select 4|
4
4
@@ -3482,7 +3482,7 @@ s1
0
1
call bug6127()|
-ERROR 23000: Duplicate entry '0' for key 1
+ERROR 23000: Duplicate entry '0' for key 's1'
select * from t3|
s1
0
@@ -4011,8 +4011,6 @@ NULL 1
call bug14643_2()|
Handler
boo
-2
-2
Handler
boo
drop procedure bug14643_1|
@@ -4360,6 +4358,11 @@ Handler
error
End
done
+call bug14498_4()|
+Handler
+error
+End
+done
call bug14498_5()|
Handler
error
diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result
index e9289cf01c7..144b32feb28 100644
--- a/mysql-test/r/sp_trans.result
+++ b/mysql-test/r/sp_trans.result
@@ -82,7 +82,7 @@ end if;
return i;
end|
insert into t1 values (bug10015_5(4)), (bug10015_5(5))|
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t1|
id
1
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
index ca5e6e1a32f..c5570e7b4f7 100644
--- a/mysql-test/r/temp_table.result
+++ b/mysql-test/r/temp_table.result
@@ -77,7 +77,7 @@ drop table t1,t2;
create temporary table t1 (a int not null);
insert into t1 values (1),(1);
alter table t1 add primary key (a);
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
drop table t1;
CREATE TABLE t1 (
d datetime default NULL
diff --git a/mysql-test/r/type_binary.result b/mysql-test/r/type_binary.result
index 597defb7a9b..34cbc9efabf 100644
--- a/mysql-test/r/type_binary.result
+++ b/mysql-test/r/type_binary.result
@@ -47,7 +47,7 @@ create table t1 (s1 binary(2) primary key);
insert into t1 values (0x01);
insert into t1 values (0x0120);
insert into t1 values (0x0100);
-ERROR 23000: Duplicate entry '' for key 1
+ERROR 23000: Duplicate entry '' for key 'PRIMARY'
select hex(s1) from t1 order by s1;
hex(s1)
0100
diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result
index 590ce08c80d..2b69fc79835 100644
--- a/mysql-test/r/type_bit.result
+++ b/mysql-test/r/type_bit.result
@@ -71,7 +71,7 @@ hex(a)
1
1
alter table t1 add unique (a);
-ERROR 23000: Duplicate entry '' for key 1
+ERROR 23000: Duplicate entry '' for key 'a'
drop table t1;
create table t1 (a bit(2));
insert into t1 values (b'00'), (b'01'), (b'10'), (b'100');
diff --git a/mysql-test/r/type_bit_innodb.result b/mysql-test/r/type_bit_innodb.result
index 20eadd94342..3481159396c 100644
--- a/mysql-test/r/type_bit_innodb.result
+++ b/mysql-test/r/type_bit_innodb.result
@@ -71,7 +71,7 @@ hex(a)
1
1
alter table t1 add unique (a);
-ERROR 23000: Duplicate entry '' for key 1
+ERROR 23000: Duplicate entry '' for key 'a'
drop table t1;
create table t1 (a bit(2)) engine=innodb;
insert into t1 values (b'00'), (b'01'), (b'10'), (b'100');
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index b366b1ed755..cbd716ad110 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -530,9 +530,9 @@ l longblob NULL YES NULL #
drop table t1;
create table t1 (id integer primary key auto_increment, txt text not null, unique index txt_index (txt (20)));
insert into t1 (txt) values ('Chevy'), ('Chevy ');
-ERROR 23000: Duplicate entry 'Chevy ' for key 2
+ERROR 23000: Duplicate entry 'Chevy ' for key 'txt_index'
insert into t1 (txt) values ('Chevy'), ('CHEVY');
-ERROR 23000: Duplicate entry 'Chevy' for key 2
+ERROR 23000: Duplicate entry 'Chevy' for key 'txt_index'
alter table t1 drop index txt_index, add index txt_index (txt(20));
insert into t1 (txt) values ('Chevy ');
select * from t1 where txt='Chevy';
diff --git a/mysql-test/r/type_varchar.result b/mysql-test/r/type_varchar.result
index e74850bba33..1de87ad529e 100644
--- a/mysql-test/r/type_varchar.result
+++ b/mysql-test/r/type_varchar.result
@@ -62,7 +62,7 @@ binary v='a '
1
insert into t1 values('a');
alter table t1 add primary key (v);
-ERROR 23000: Duplicate entry 'a' for key 1
+ERROR 23000: Duplicate entry 'a' for key 'PRIMARY'
drop table t1;
create table t1 (v varbinary(20));
insert into t1 values('a');
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index af49099836f..5396db82965 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -2495,3 +2495,37 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
DROP VIEW v1;
DROP TABLE t1;
+CREATE TABLE t1 (x varchar(10));
+INSERT INTO t1 VALUES (null), ('foo'), ('bar'), (null);
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT IF(x IS NULL, 'blank', 'not blank') FROM v1 GROUP BY x;
+IF(x IS NULL, 'blank', 'not blank')
+blank
+not blank
+not blank
+SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM t1 GROUP BY x;
+x
+blank
+not blank
+not blank
+Warnings:
+Warning 1052 Column 'x' in group statement is ambiguous
+SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM v1;
+x
+blank
+not blank
+not blank
+blank
+SELECT IF(x IS NULL, 'blank', 'not blank') AS y FROM v1 GROUP BY y;
+y
+blank
+not blank
+SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM v1 GROUP BY x;
+x
+blank
+not blank
+not blank
+Warnings:
+Warning 1052 Column 'x' in group statement is ambiguous
+DROP VIEW v1;
+DROP TABLE t1;
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index 95fdda3113a..9f9d3b53063 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -166,13 +166,6 @@ show variables like 'max_error_count';
Variable_name Value
max_error_count 10
drop table t1;
-create table t1 (id int) type=heap;
-Warnings:
-Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
-alter table t1 type=myisam;
-Warnings:
-Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
-drop table t1;
set table_type=MYISAM;
Warnings:
Warning 1287 'table_type' is deprecated; use 'storage_engine' instead
diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test
index 77d250b5c45..e8bf840facc 100644
--- a/mysql-test/t/ctype_ujis.test
+++ b/mysql-test/t/ctype_ujis.test
@@ -94,7 +94,7 @@ CREATE TABLE t1
b VARCHAR(50) NOT NULL DEFAULT '',
PRIMARY KEY (a),
KEY b (b(10))
-) TYPE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+) ENGINE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
--enable_warnings
INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
@@ -110,7 +110,7 @@ CREATE TABLE t1
b VARCHAR(50) NOT NULL DEFAULT '',
PRIMARY KEY (a),
KEY b (b(10))
-) TYPE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+) ENGINE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
--enable_warnings
INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 5010e8afb81..7555df95b04 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -10,26 +10,25 @@
#
##############################################################################
-sp-goto : GOTO is currently is disabled - will be fixed in the future
-rpl_bit_npk : Bug #13418
-events : Test case instability - infinite locking. To be fixed.
-func_group : Bug #15448
-func_math : Bug #15448
-group_min_max : Bug #15448
-innodb_concurrent : Results are not deterministic, Elliot will fix (BUG#3300)
-innodb_unsafe_binlog : re-enable with InnoDB 5.1 snapshot containing bug#15650
-subselect : Bug#15706
-ps_7ndb : dbug assert in RBR mode when executing test suite
-rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
-partition_03ndb : Bug#16385
-ndb_binlog_basic : Results are not deterministic, Tomas will fix
-rpl_ndb_basic : Bug#16228
-rpl_sp : Bug #16456
-ndb_autodiscover : Needs to be fixed w.r.t binlog
-ndb_autodiscover2 : Needs to be fixed w.r.t binlog
+events : Test case instability - infinite locking. To be fixed.
+func_group : Bug#15448
+func_math : Bug#15448
+group_min_max : Bug#15448
#ndb_alter_table_row : sometimes wrong error 1015!=1046
-ndb_gis : garbled msgs from corrupt THD*
-rpl_ndb_auto_inc : MySQL Bugs:17086
-rpl_ndb_relay_space : Bug 16993
-ndb_binlog_ddl_multi : Bug #17038
-rpl_ndb_log : MySQL Bugs: #17158
+ndb_autodiscover : Needs to be fixed w.r.t binlog
+ndb_autodiscover2 : Needs to be fixed w.r.t binlog
+ndb_binlog_basic : Results are not deterministic, Tomas will fix
+ndb_binlog_ddl_multi : Bug#17038 [PATCH PENDING]
+ndb_gis : garbled msgs from corrupt THD*
+ndb_load : Bug#17233
+partition_03ndb : Bug#16385
+ps_7ndb : dbug assert in RBR mode when executing test suite
+rpl_bit_npk : Bug#13418
+rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
+rpl_ndb_auto_inc : Bug#17086
+rpl_ndb_basic : Bug#16228 [IN REVIEW]
+rpl_ndb_relay_space : Bug#16993
+rpl_sp : Bug#16456
+rpl_until : Unstable test case, bug#15886
+sp-goto : GOTO is currently is disabled - will be fixed in the future
+subselect : Bug#15706 (ps mode) [PATCH PENDING]
diff --git a/mysql-test/t/events.test b/mysql-test/t/events.test
index be24d490393..aa759d5ca6f 100644
--- a/mysql-test/t/events.test
+++ b/mysql-test/t/events.test
@@ -17,12 +17,12 @@ drop event event2;
create event e_43 on schedule every 1 second do set @a = 5;
set global event_scheduler = 1;
-select sleep(2);
+--sleep 2
alter event e_43 do alter event e_43 do set @a = 4;
-select sleep(3);
+--sleep 2
select db, name, body, status, interval_field, interval_value from mysql.event;
drop event e_43;
-select sleep(1);
+--sleep 1
set global event_scheduler = 0;
create table t_event3 (a int, b float);
@@ -107,8 +107,8 @@ drop event one_event;
##INFORMATION_SCHEMA.EVENTS test end
#
-
-
+--echo "Sleep a bit so the server closes the second connection"
+--sleep 2
create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
@@ -129,23 +129,38 @@ set event_scheduler=0;
--error 1231
set global event_scheduler=2;
-#set global event_scheduler=0;
-#select count(*) from mysql.event;
-#select get_lock("test_lock1", 20);
-#create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
-#select count(*) from mysql.event;
-##show processlist;
-#select release_lock("test_lock1");
-#drop event закачка;
-#select count(*) from mysql.event;
+--echo "DISABLE the scheduler. Testing that it does not work when the variable is 0"
+set global event_scheduler=0;
+select definer, name, db from mysql.event;
+select get_lock("test_lock1", 20);
+create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
+--echo "Should return 1 row"
+select definer, name, db from mysql.event;
+
+--echo "Should be only 1 process"
+--replace_column 1 # 6 #
+show processlist;
+select release_lock("test_lock1");
+drop event закачка;
+--echo "Should have 0 events"
+select count(*) from mysql.event;
+
#
-#set global event_scheduler=1;
-#select get_lock("test_lock2", 20);
-#create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
-#select sleep(2);
-#show processlist;
-#select release_lock("test_lock2");
-#drop event закачка;
+#
+#
+--echo "ENABLE the scheduler and get a lock"
+set global event_scheduler=1;
+select get_lock("test_lock2", 20);
+--echo "Create an event which tries to acquire a mutex. The event locks on the mutex"
+create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
+--echo "Let some time pass to the event starts"
+--sleep 2
+--echo "Should have only 3 processes: the scheduler, our conn and the locked event"
+--replace_column 1 # 6 #
+show processlist;
+--echo "Release the mutex, the event worker should finish."
+select release_lock("test_lock2");
+drop event закачка;
##
## 1. get a lock
@@ -155,26 +170,34 @@ set global event_scheduler=2;
## 5. kill the scheduler, it will wait for the child to stop
## 6. both processes should be there on show processlist
## 7. release the lock and sleep, both scheduler and child should end
-#set global event_scheduler=1;
-#select get_lock("test_lock2_1", 20);
-#create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
-#select sleep(2);
-##show processlist;
-#set global event_scheduler=0;
-#select sleep(2);
-##show processlist;
-#select release_lock("test_lock2_1");
-#select sleep(2);
-##show processlist;
-#drop event закачка21;
-
-#set global event_scheduler=1;
-#select get_lock("test_lock3", 20);
-#create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);
-#select sleep(2);
+set global event_scheduler=1;
+select get_lock("test_lock2_1", 20);
+create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
+--sleep 1
+--echo "Should see 2 processes, one locked on get_lock("
+#--replace_column 1 # 6 #
#show processlist;
-#drop event закачка;
-#select release_lock("test_lock3");
+--echo "Shutting down the scheduler, it should wait for the running event"
+set global event_scheduler=0;
+--sleep 1
+--echo "Should have only 3 processes: the scheduler, our conn and the locked event"
+--replace_column 1 # 6 #
+show processlist;
+--echo "Release the lock so the child process should finish. Hence the scheduler also"
+select release_lock("test_lock2_1");
+--sleep 1
+--echo "Should have only our process now:"
+--replace_column 1 # 6 #
+show processlist;
+drop event закачка21;
+
+##set global event_scheduler=1;
+##select get_lock("test_lock3", 20);
+##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);
+##select sleep(2);
+##show processlist;
+##drop event закачка;
+##select release_lock("test_lock3");
#
# test with very often occuring event
@@ -182,14 +205,15 @@ set global event_scheduler=2;
##select get_lock("test_lock4", 20);
##create event закачка4 on schedule every 1 second do select get_lock("test_lock4", 20);
##select sleep(3);
+##--replace_column 1 # 6 #
##show processlist;
##drop event закачка4;
##select release_lock("test_lock4");
-#set global event_scheduler=0;
-#select sleep(2);
+##set global event_scheduler=0;
+##select sleep(2);
+##--replace_column 1 # 6 #
##show processlist;
-##the following locks for some reason and is a bug, commented for now
##select count(*) from mysql.event;
drop database events_test;
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 7974b74081a..590a7dc495b 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -371,4 +371,16 @@ CREATE TABLE t1 (a VARCHAR(10000), FULLTEXT(a));
SHOW CREATE TABLE t1;
DROP TABLE t1;
+#
+# BUG#14496: Crash or strange results with prepared statement,
+# MATCH and FULLTEXT
+#
+CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a));
+INSERT INTO t1 VALUES('test'),('test1'),('test');
+PREPARE stmt from "SELECT a, MATCH(a) AGAINST('test1 test') FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
+EXECUTE stmt;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 9cf0ee452cd..8dc4eb215c7 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -141,3 +141,17 @@ select log(2,-1);
select log(-2,1);
set sql_mode='';
+#
+# Bug #8461 truncate() and round() return false results 2nd argument negative.
+#
+# round(a,-b) log_10(b) > a
+select round(111,-10);
+# round on bigint
+select round(-5000111000111000155,-1);
+# round on unsigned bigint
+select round(15000111000111000155,-1);
+# truncate on bigint
+select truncate(-5000111000111000155,-1);
+# truncate on unsigned bigint
+select truncate(15000111000111000155,-1);
+
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index e15ef92116c..8dc55532bbf 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -715,3 +715,24 @@ select distinct c1, c2 from t1 order by c2;
select c1,min(c2) as c2 from t1 group by c1 order by c2;
select c1,c2 from t1 group by c1,c2 order by c2;
drop table t1;
+
+#
+# Bug #16203: Analysis for possible min/max optimization erroneously
+# returns impossible range
+#
+
+CREATE TABLE t1 (a varchar(5), b int(11), PRIMARY KEY (a,b));
+INSERT INTO t1 VALUES ('AA',1), ('AA',2), ('AA',3), ('BB',1), ('AA',4);
+OPTIMIZE TABLE t1;
+
+SELECT a FROM t1 WHERE a='AA' GROUP BY a;
+SELECT a FROM t1 WHERE a='BB' GROUP BY a;
+
+EXPLAIN SELECT a FROM t1 WHERE a='AA' GROUP BY a;
+EXPLAIN SELECT a FROM t1 WHERE a='BB' GROUP BY a;
+
+SELECT DISTINCT a FROM t1 WHERE a='BB';
+SELECT DISTINCT a FROM t1 WHERE a LIKE 'B%';
+SELECT a FROM t1 WHERE a LIKE 'B%' GROUP BY a;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test
index 1cc894697f9..78628bef198 100644
--- a/mysql-test/t/having.test
+++ b/mysql-test/t/having.test
@@ -135,6 +135,22 @@ SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a);
DROP TABLE t1;
+#
+# Bug #14927: HAVING clause containing constant false conjunct
+#
+
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1), (2), (1), (3), (2), (1);
+
+SELECT a FROM t1 GROUP BY a HAVING a > 1;
+SELECT a FROM t1 GROUP BY a HAVING 1 != 1 AND a > 1;
+SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
+
+EXPLAIN SELECT a FROM t1 GROUP BY a HAVING 1 != 1 AND a > 1;
+EXPLAIN SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
+
+DROP table t1;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test
index 6a8abdeea26..82294db336d 100644
--- a/mysql-test/t/heap.test
+++ b/mysql-test/t/heap.test
@@ -440,10 +440,10 @@ drop table t1;
# Bug 12796: Record doesn't show when selecting through index
#
CREATE TABLE t1 (a int, key(a)) engine=heap;
-insert delayed into t1 values (0);
+insert into t1 values (0);
delete from t1;
select * from t1;
-insert delayed into t1 values (0), (1);
+insert into t1 values (0), (1);
select * from t1 where a = 0;
drop table t1;
diff --git a/mysql-test/t/im_life_cycle.imtest b/mysql-test/t/im_life_cycle.imtest
index c2b1c9a56ec..2ea0c151d5a 100644
--- a/mysql-test/t/im_life_cycle.imtest
+++ b/mysql-test/t/im_life_cycle.imtest
@@ -18,9 +18,9 @@
###########################################################################
SHOW INSTANCES;
---replace_column 3 VERSION
+--replace_column 3 VERSION_NUMBER 4 VERSION
SHOW INSTANCE STATUS mysqld1;
---replace_column 3 VERSION
+--replace_column 3 VERSION_NUMBER 4 VERSION
SHOW INSTANCE STATUS mysqld2;
###########################################################################
@@ -38,9 +38,9 @@ START INSTANCE mysqld2;
--sleep 3
SHOW INSTANCES;
---replace_column 3 VERSION
+--replace_column 3 VERSION_NUMBER 4 VERSION
SHOW INSTANCE STATUS mysqld1;
---replace_column 3 VERSION
+--replace_column 3 VERSION_NUMBER 4 VERSION
SHOW INSTANCE STATUS mysqld2;
--connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
@@ -66,9 +66,9 @@ STOP INSTANCE mysqld2;
--sleep 3
SHOW INSTANCES;
---replace_column 3 VERSION
+--replace_column 3 VERSION_NUMBER 4 VERSION
SHOW INSTANCE STATUS mysqld1;
---replace_column 3 VERSION
+--replace_column 3 VERSION_NUMBER 4 VERSION
SHOW INSTANCE STATUS mysqld2;
###########################################################################
@@ -140,3 +140,12 @@ SHOW INSTANCES;
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed
SHOW INSTANCES;
+
+###########################################################################
+#
+# 1.1.8. Check that Instance Manager returns an error on
+# incomplete SHOW INSTANCE STATUS command.
+#
+###########################################################################
+--error 1149
+SHOW INSTANCE STATUS;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 10cb1dcf08b..ceffc3ada5b 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1715,3 +1715,32 @@ create table t1 (a varchar(255) character set utf8,
key (a,b,c,d,e)) engine=innodb;
--echo End of 5.0 tests
+
+#
+# Test that cascading updates leading to duplicate keys give the correct
+# error message (bug #9680)
+#
+
+CREATE TABLE t1 (
+ field1 varchar(8) NOT NULL DEFAULT '',
+ field2 varchar(8) NOT NULL DEFAULT '',
+ PRIMARY KEY (field1, field2)
+) ENGINE=InnoDB;
+
+CREATE TABLE t2 (
+ field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY,
+ FOREIGN KEY (field1) REFERENCES t1 (field1)
+ ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES ('old', 'somevalu');
+INSERT INTO t1 VALUES ('other', 'anyvalue');
+
+INSERT INTO t2 VALUES ('old');
+INSERT INTO t2 VALUES ('other');
+
+--error ER_FOREIGN_DUPLICATE_KEY
+UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
+
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/mysql-test/t/innodb_concurrent.test b/mysql-test/t/innodb_concurrent.test
index 1595fcd2467..957276a44c7 100644
--- a/mysql-test/t/innodb_concurrent.test
+++ b/mysql-test/t/innodb_concurrent.test
@@ -11,7 +11,7 @@
connection default;
drop table if exists t1;
-create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb;
connect (thread1, localhost, mysqltest,,);
connection thread1;
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
@@ -57,7 +57,7 @@ drop table t1;
#
#connect (thread1, localhost, mysqltest,,);
connection thread1;
-create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb;
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
@@ -132,7 +132,7 @@ drop table t1;
#
#connect (thread1, localhost, mysqltest,,);
connection thread1;
-create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb;
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
@@ -175,7 +175,7 @@ drop table t1;
#
#connect (thread1, localhost, mysqltest,,);
connection thread1;
-create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb;
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
@@ -218,7 +218,7 @@ drop table t1;
#
#connect (thread1, localhost, mysqltest,,);
connection thread1;
-create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb;
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
@@ -261,7 +261,7 @@ drop table t1;
#
#connect (thread1, localhost, mysqltest,,);
connection thread1;
-create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb;
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
@@ -305,7 +305,7 @@ drop table t1;
#
#connect (thread1, localhost, mysqltest,,);
connection thread1;
-create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb;
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index 9a8f61b1052..8302c767985 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -84,7 +84,7 @@ select ((@id := kill_id) - kill_id) from t3;
kill @id;
connection conn1;
--- error 1053
+-- error 1053,2013
reap;
connection default;
diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test
index 794beaa2a4d..7b7c30f002f 100644
--- a/mysql-test/t/log_tables.test
+++ b/mysql-test/t/log_tables.test
@@ -144,7 +144,24 @@ reap;
select "Mark that we woke up from TRUNCATE in the test"
as "test passed";
-disconnect con2;
+connection con1;
+
+use test;
+
+#
+# Bug #16905 Log tables: unicode statements are logged incorrectly
+#
+
+truncate table mysql.general_log;
+set names utf8;
+create table bug16905 (s char(15) character set utf8 default 'пусто');
+insert into bug16905 values ('новое');
+--replace_column 1 TIMESTAMP
+select * from mysql.general_log;
+drop table bug16905;
+
+# kill all connections
disconnect con1;
+disconnect con2;
--enable_ps_protocol
diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test
index e99503843bd..93bcc9b9050 100644
--- a/mysql-test/t/ndb_basic.test
+++ b/mysql-test/t/ndb_basic.test
@@ -625,6 +625,72 @@ CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
select * from t1;
drop table t1;
+#
+# Bug #17249 delete statement with join where clause fails
+# when table do not have pk
+#
+
+create table t1 (a int) engine=ndb;
+create table t2 (a int) engine=ndb;
+insert into t1 values (1);
+insert into t2 values (1);
+delete t1.* from t1, t2 where t1.a = t2.a;
+select * from t1;
+select * from t2;
+drop table t1;
+drop table t2;
+
+#
+# Bug #17257 update fails for inner joins if tables
+# do not have Primary Key
+#
+
+CREATE TABLE t1 (
+ i INT,
+ j INT,
+ x INT,
+ y INT,
+ z INT
+) engine=ndb;
+
+CREATE TABLE t2 (
+ i INT,
+ k INT,
+ x INT,
+ y INT,
+ z INT
+) engine=ndb;
+
+CREATE TABLE t3 (
+ j INT,
+ k INT,
+ x INT,
+ y INT,
+ z INT
+) engine=ndb;
+
+INSERT INTO t1 VALUES ( 1, 2,13,14,15);
+INSERT INTO t2 VALUES ( 1, 3,23,24,25);
+INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
+
+UPDATE t1 AS a
+INNER JOIN t2 AS b
+ ON a.i = b.i
+INNER JOIN t3 AS c
+ ON a.j = c.j AND b.k = c.k
+SET a.x = b.x,
+ a.y = b.y,
+ a.z = (
+ SELECT sum(z)
+ FROM t3
+ WHERE y = 34
+ )
+WHERE b.x = 23;
+select * from t1;
+drop table t1;
+drop table t2;
+drop table t3;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/ndb_blob.test b/mysql-test/t/ndb_blob.test
index a12ebee2f0d..f80b7f71281 100644
--- a/mysql-test/t/ndb_blob.test
+++ b/mysql-test/t/ndb_blob.test
@@ -338,7 +338,7 @@ select * from t1 order by a;
drop table t1;
drop database test2;
-# -- bug-5252 tinytext crashes plus no-commit result --
+# -- bug-5252 tinytext crashes + no-commit result + replace --
set autocommit=0;
create table t1 (
@@ -352,6 +352,10 @@ select * from t1;
delete from t1;
select * from t1;
commit;
+replace t1 set a=2, b='y';
+select * from t1;
+delete from t1;
+select * from t1;
drop table t1;
# -- bug-5013 insert empty string to text --
diff --git a/mysql-test/t/ndb_index_unique.test b/mysql-test/t/ndb_index_unique.test
index 2185276c2c6..8561b3794c4 100644
--- a/mysql-test/t/ndb_index_unique.test
+++ b/mysql-test/t/ndb_index_unique.test
@@ -309,4 +309,18 @@ select * from t1 where code = '12' and month = 4 and year = 2004 ;
drop table t1;
+# bug#15918 Unique Key Limit in NDB Engine
+
+create table t1 (a int primary key, b varchar(1000) not null, unique key (b))
+engine=ndb charset=utf8;
+
+insert into t1 values (1, repeat(_utf8 0xe288ab6474, 200));
+--error 1062
+insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200));
+select a, sha1(b) from t1;
+
+# perl -e 'print pack("H2000","e288ab6474"x200)' | sha1sum
+
+drop table t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/ndb_view.test b/mysql-test/t/ndb_view.test
new file mode 100644
index 00000000000..3b8fc330b40
--- /dev/null
+++ b/mysql-test/t/ndb_view.test
@@ -0,0 +1,29 @@
+-- source include/have_ndb.inc
+-- source include/not_embedded.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3;
+DROP VIEW IF EXISTS v1,v2,v3;
+--enable_warnings
+
+#
+# simple operations via view
+#
+
+create table t1 (a int, b int, c int, d int) engine=ndb;
+insert into t1 values (1,2,3,4),(5,6,7,8);
+
+create view v1 as select t1.c as a, t1.a as b, t1.d as c, t1.a+t1.b+t1.c as d from t1;
+select * from v1 order by a,b,c;
+
+update v1 set a=a+100 where b=1;
+select * from v1 order by a,b,c;
+
+drop view v1;
+
+create view v1 as select t1.c as a from t1;
+insert into v1 values (200);
+select * from t1 order by a,b,c,d;
+
+drop view v1;
+drop table t1;
diff --git a/mysql-test/t/raid.test b/mysql-test/t/raid.test
deleted file mode 100644
index 3ca5adaaaea..00000000000
--- a/mysql-test/t/raid.test
+++ /dev/null
@@ -1,224 +0,0 @@
--- require r/have_raid.require
-disable_query_log;
-show variables like "have_raid";
-enable_query_log;
-
-#
-# Test of raided tables
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2;
-DROP DATABASE IF EXISTS test_$1;
---enable_warnings
-
-#
-# Test dropping database with raid tables
-#
-
-create database test_$1;
-create table test_$1.r1 (i int) raid_type=1;
-create table test_$1.r2 (i int) raid_type=1 raid_chunks=32;
-drop database test_$1;
-
-#
-# Bug #3182: Test using more than 257 raid chunks
-#
-create database test_$1;
-create table test_$1.r2 (i int) raid_type=1 raid_chunks=257;
-show create table test_$1.r2;
-drop database test_$1;
-
-#
-# Test that data is spread over different raid directories
-#
-
-CREATE TABLE t1 (
-id int unsigned not null auto_increment primary key,
-c char(255) not null
-) RAID_TYPE=STRIPED RAID_CHUNKS=2 RAID_CHUNKSIZE=123;
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-select count(*) from t1;
-ALTER TABLE t1 ADD COLUMN x INT UNSIGNED NOT NULL;
-ALTER TABLE t1 ADD KEY c (c);
-ALTER TABLE t1 DROP KEY c;
-ALTER TABLE t1 DROP COLUMN x;
-ALTER TABLE t1 RENAME t2;
-select count(*) from t2;
-DROP TABLE t2;
-
-/* variable rows */
-CREATE TABLE t1 (
-id int unsigned not null auto_increment primary key,
-c varchar(255) not null
-) RAID_TYPE=STRIPED RAID_CHUNKS=5 RAID_CHUNKSIZE=121;
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-select count(*) from t1;
-ALTER TABLE t1 ADD COLUMN x INT UNSIGNED NOT NULL;
-ALTER TABLE t1 ADD KEY c (c);
-ALTER TABLE t1 DROP KEY c;
-ALTER TABLE t1 DROP COLUMN x;
-ALTER TABLE t1 RENAME t2;
-ALTER TABLE t2 CHANGE COLUMN c c VARCHAR(251) NOT NULL;
-select count(*) from t2;
-DROP TABLE t2;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_heap.test b/mysql-test/t/rpl_heap.test
index 03c9070678b..2436b851a03 100644
--- a/mysql-test/t/rpl_heap.test
+++ b/mysql-test/t/rpl_heap.test
@@ -18,7 +18,7 @@ reset master;
drop table if exists t1;
# we use CREATE SELECT to verify that DELETE does not get into binlog
# before CREATE SELECT
-create table t1 type=HEAP select 10 as a;
+create table t1 engine=HEAP select 10 as a;
insert into t1 values(11);
save_master_pos;
--replace_column 2 # 5 #
diff --git a/mysql-test/t/rpl_ndb_bank.test b/mysql-test/t/rpl_ndb_bank.test
index 1b900236963..817f40f2fa3 100644
--- a/mysql-test/t/rpl_ndb_bank.test
+++ b/mysql-test/t/rpl_ndb_bank.test
@@ -10,14 +10,14 @@
# 5. check that the slave and master BANK databases are the same
#
-# kill any trailing processes
---system killall lt-bankTransactionMaker lt-bankTimer lt-bankMakeGL || true
-
--source include/have_ndb.inc
--source include/have_ndb_extra.inc
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
+# kill any trailing processes
+--system killall lt-bankTransactionMaker lt-bankTimer lt-bankMakeGL || true
+
--disable_warnings
# initialize master
--connection master
diff --git a/mysql-test/t/rpl_ndb_sync.test b/mysql-test/t/rpl_ndb_sync.test
index 2e1e96d87de..143ff6d6651 100644
--- a/mysql-test/t/rpl_ndb_sync.test
+++ b/mysql-test/t/rpl_ndb_sync.test
@@ -27,8 +27,7 @@ SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
# take a backup on master
--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > var/tmp.dat
-CREATE TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT);
-DELETE FROM cluster_replication.backup_info;
+CREATE TEMPORARY TABLE cluster_replication.backup_info (id INT, backup_id INT) ENGINE=HEAP;
LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ',';
--replace_column 1
SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info;
diff --git a/mysql-test/t/rpl_row_trig001.test b/mysql-test/t/rpl_row_trig001.test
index e2f10ecf1fa..f2584933a32 100644
--- a/mysql-test/t/rpl_row_trig001.test
+++ b/mysql-test/t/rpl_row_trig001.test
@@ -81,6 +81,7 @@ let $message=;
# First lets cleanup
DROP PROCEDURE test.p2;
+DROP PROCEDURE test.p3;
DROP TRIGGER test.t2_ai;
DROP TRIGGER test.t3_bi_t2;
DROP TABLE test.t1;
diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test
index 25f87f9e661..5fc81c338c6 100644
--- a/mysql-test/t/sp-destruct.test
+++ b/mysql-test/t/sp-destruct.test
@@ -127,6 +127,15 @@ create trigger t1_ai after insert on t1 for each row call bug14233_3();
insert into t1 values (0);
# Clean-up
-delete from mysql.proc where name like 'bug14233%';
drop trigger t1_ai;
drop table t1;
+
+#
+# BUG#16303: erroneus stored procedures and functions should be droppable
+#
+drop function bug14233_1;
+drop function bug14233_2;
+drop procedure bug14233_3;
+# Assert: These should show nothing.
+show procedure status;
+show function status;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 74585a0d3b7..45de4010535 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -5125,10 +5125,7 @@ end|
call bug14498_1()|
call bug14498_2()|
call bug14498_3()|
-# We couldn't call this before, due to a known bug (BUG#14643)
-# QQ We still can't since the new set_case_expr instruction breaks
-# the semantics of case; it won't crash, but will get the wrong result.
-#call bug14498_4()|
+call bug14498_4()|
call bug14498_5()|
drop procedure bug14498_1|
diff --git a/mysql-test/t/system_mysql_db_fix.test b/mysql-test/t/system_mysql_db_fix.test
index 11ed48011d7..18e1efb3120 100644
--- a/mysql-test/t/system_mysql_db_fix.test
+++ b/mysql-test/t/system_mysql_db_fix.test
@@ -38,7 +38,7 @@ CREATE TABLE db (
PRIMARY KEY Host (Host,Db,User),
KEY User (User)
)
-type=MyISAM;
+engine=MyISAM;
--enable-warnings
INSERT INTO db VALUES ('%','test', '','Y','Y','Y','Y','Y','Y');
@@ -56,7 +56,7 @@ CREATE TABLE host (
Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
PRIMARY KEY Host (Host,Db)
)
-type=MyISAM;
+engine=MyISAM;
--enable-warnings
--disable_warnings
@@ -75,7 +75,7 @@ CREATE TABLE user (
Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,
PRIMARY KEY Host (Host,User)
)
-type=MyISAM;
+engine=MyISAM;
--enable-warnings
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y');
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index d5aff94e47c..5d1b5a80a9b 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -2358,3 +2358,20 @@ EXPLAIN SELECT MIN(a) FROM v1;
DROP VIEW v1;
DROP TABLE t1;
+
+#
+# Bug#16382: grouping name is resolved against a view column name
+# which coincides with a select column name
+
+CREATE TABLE t1 (x varchar(10));
+INSERT INTO t1 VALUES (null), ('foo'), ('bar'), (null);
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+SELECT IF(x IS NULL, 'blank', 'not blank') FROM v1 GROUP BY x;
+SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM t1 GROUP BY x;
+SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM v1;
+SELECT IF(x IS NULL, 'blank', 'not blank') AS y FROM v1 GROUP BY y;
+SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM v1 GROUP BY x;
+
+DROP VIEW v1;
+DROP TABLE t1;
diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test
index e0563cc97b5..a1a38298345 100644
--- a/mysql-test/t/warnings.test
+++ b/mysql-test/t/warnings.test
@@ -117,14 +117,6 @@ drop table t1;
#alter table t1 engine=isam;
#drop table t1;
-#
-# Test for deprecated TYPE= syntax
-#
-
-create table t1 (id int) type=heap;
-alter table t1 type=myisam;
-drop table t1;
-
#
# Test for deprecated table_type variable
#
diff --git a/scripts/fill_func_tables.sh b/scripts/fill_func_tables.sh
index 203c730dd9a..83501886d88 100644
--- a/scripts/fill_func_tables.sh
+++ b/scripts/fill_func_tables.sh
@@ -140,7 +140,7 @@ print " max_args tinyint,";
print " date_created datetime not null,";
print " last_modified timestamp not null,";
print " primary key (func_id)";
-print ") type=myisam;\n\n";
+print ") ENGINE=MYISAM;\n\n";
print "DROP TABLE IF EXISTS function_category_name;\n";
print "CREATE TABLE function_category_name (";
@@ -150,14 +150,14 @@ print " url char(128) not null,";
print " date_created datetime not null,";
print " last_modified timestamp not null,";
print " primary key (cat_id)";
-print ") type=myisam;\n\n";
+print ") ENGINE=MYISAM;\n\n";
print "DROP TABLE IF EXISTS function_category;\n";
print "CREATE TABLE function_category (";
print " cat_id smallint unsigned not null references function_category_name,";
print " func_id int unsigned not null references function,";
print " primary key (cat_id, func_id)";
-print ") type=myisam;\n\n";
+print ") ENGINE=MYISAM;\n\n";
print "DELETE FROM function_category_name;\n";
print "DELETE FROM function_category;\n";
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 2f59c3e1d4c..03c2c6d3154 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -131,7 +131,7 @@ BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \
extra/resolve_stack_dump$BS extra/mysql_waitpid$BS \
storage/myisam/myisamchk$BS storage/myisam/myisampack$BS \
storage/myisam/myisamlog$BS storage/myisam/myisam_ftdump$BS \
- sql/mysqld$BS sql/mysql_tzinfo_to_sql$BS \
+ sql/mysqld$BS sql/mysqld-debug$BS sql/mysql_tzinfo_to_sql$BS \
server-tools/instance-manager/mysqlmanager$BS \
client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \
client/mysqlslap$BS \
@@ -173,8 +173,9 @@ if [ x$STRIP = x1 ] ; then
strip $BASE/bin/*
fi
-# Copy not binary files
-copyfileto $BASE/bin sql/mysqld.sym.gz
+# Obsolete, starting from 5.1.6-beta
+# # Copy not binary files
+# copyfileto $BASE/bin sql/mysqld.sym.gz
if [ $BASE_SYSTEM = "netware" ] ; then
$CP netware/*.pl $BASE/scripts
@@ -304,11 +305,12 @@ else
rm -f $BASE/README.NW
fi
-# Make safe_mysqld a symlink to mysqld_safe for backwards portability
-# To be removed in MySQL 4.1
-if [ $BASE_SYSTEM != "netware" ] ; then
- (cd $BASE/bin ; ln -s mysqld_safe safe_mysqld )
-fi
+# Dropped with 5.1.6-beta
+# # Make safe_mysqld a symlink to mysqld_safe for backwards portability
+# # To be removed in MySQL 4.1
+# if [ $BASE_SYSTEM != "netware" ] ; then
+# (cd $BASE/bin ; ln -s mysqld_safe safe_mysqld )
+# fi
# Clean up if we did this from a bk tree
if [ -d $BASE/sql-bench/SCCS ] ; then
@@ -345,7 +347,7 @@ BASE=$BASE2
if [ x"@GXX@" = x"yes" ] ; then
gcclib=`@CC@ --print-libgcc-file`
if [ $? -ne 0 ] ; then
- print "Warning: Couldn't find libgcc.a!"
+ echo "Warning: Couldn't find libgcc.a!"
else
$CP $gcclib $BASE/lib/libmygcc.a
fi
diff --git a/scripts/mysql_convert_table_format.sh b/scripts/mysql_convert_table_format.sh
index c1955e632fb..4b68d6c5039 100644
--- a/scripts/mysql_convert_table_format.sh
+++ b/scripts/mysql_convert_table_format.sh
@@ -69,7 +69,7 @@ foreach $table (@ARGV)
}
}
print "converting $table\n" if ($opt_verbose);
- if (!$dbh->do("ALTER TABLE $table type=$opt_type"))
+ if (!$dbh->do("ALTER TABLE $table ENGINE=$opt_type"))
{
print STDERR "Can't convert $table: Error $DBI::errstr\n";
exit(1) if (!$opt_force);
@@ -114,7 +114,7 @@ Conversion of a MySQL tables to other table types.
--socket='/path/to/socket'
Socket to connect with.
---type='table-type'
+--ENGINE='table-type'
Converts tables to the given table type (Default: $opt_type)
MySQL 3.23 supports at least the BDB, ISAM and MYISAM types.
diff --git a/server-tools/instance-manager/Makefile.am b/server-tools/instance-manager/Makefile.am
index 7449735f0bf..043a0336b93 100644
--- a/server-tools/instance-manager/Makefile.am
+++ b/server-tools/instance-manager/Makefile.am
@@ -30,11 +30,9 @@ liboptions_a_CXXFLAGS= $(CXXFLAGS) \
-DDEFAULT_PID_FILE_NAME="$(localstatedir)/mysqlmanager.pid" \
-DDEFAULT_LOG_FILE_NAME="$(localstatedir)/mysqlmanager.log" \
-DDEFAULT_SOCKET_FILE_NAME="/tmp/mysqlmanager.sock" \
- -DDEFAULT_PASSWORD_FILE_NAME="$(sysconfdir)/mysqlmanager.passwd" \
+ -DDEFAULT_PASSWORD_FILE_NAME="/etc/mysqlmanager.passwd" \
-DDEFAULT_MYSQLD_PATH="$(libexecdir)/mysqld$(EXEEXT)" \
- -DDEFAULT_MONITORING_INTERVAL="20" \
- -DDEFAULT_PORT="2273" \
- -DDEFAULT_CONFIG_FILE="/etc/my.cnf" \
+ -DDEFAULT_CONFIG_FILE="/etc/my.cnf" \
-DPROTOCOL_VERSION=@PROTOCOL_VERSION@
liboptions_a_SOURCES= options.h options.cc priv.h priv.cc
@@ -79,7 +77,8 @@ mysqlmanager_SOURCES= command.cc command.h mysqlmanager.cc \
mysql_manager_error.h \
portability.h
-mysqlmanager_LDADD= liboptions.a \
+mysqlmanager_LDADD= @CLIENT_EXTRA_LDFLAGS@ \
+ liboptions.a \
libnet.a \
$(top_builddir)/vio/libvio.a \
$(top_builddir)/mysys/libmysys.a \
diff --git a/server-tools/instance-manager/commands.cc b/server-tools/instance-manager/commands.cc
index b4dd1b469f1..7b999f61503 100644
--- a/server-tools/instance-manager/commands.cc
+++ b/server-tools/instance-manager/commands.cc
@@ -25,6 +25,7 @@
#include "options.h"
#include
+#include
#include
#include
@@ -62,6 +63,31 @@ static inline int put_to_buff(Buffer *buff, const char *str, uint *position)
}
+static int parse_version_number(const char *version_str, char *version,
+ uint version_size)
+{
+ const char *start= version_str;
+ const char *end;
+
+ // skip garbage
+ while (!my_isdigit(default_charset_info, *start))
+ start++;
+
+ end= start;
+ // skip digits and dots
+ while (my_isdigit(default_charset_info, *end) || *end == '.')
+ end++;
+
+ if ((uint)(end - start) >= version_size)
+ return -1;
+
+ strncpy(version, start, end-start);
+ version[end-start]= '\0';
+
+ return 0;
+}
+
+
/* implementation for Show_instances: */
@@ -174,9 +200,10 @@ int Show_instance_status::execute(struct st_net *net,
{
enum { MAX_VERSION_LENGTH= 40 };
Buffer send_buff; /* buffer for packets */
- LIST name, status, version;
+ LIST name, status, version, version_number;
LIST *field_list;
- NAME_WITH_LENGTH name_field, status_field, version_field;
+ NAME_WITH_LENGTH name_field, status_field, version_field,
+ version_number_field;
uint position=0;
if (!instance_name)
@@ -192,7 +219,11 @@ int Show_instance_status::execute(struct st_net *net,
version_field.name= (char*) "version";
version_field.length= MAX_VERSION_LENGTH;
version.data= &version_field;
+ version_number_field.name= (char*) "version_number";
+ version_number_field.length= MAX_VERSION_LENGTH;
+ version_number.data= &version_number_field;
field_list= list_add(NULL, &version);
+ field_list= list_add(field_list, &version_number);
field_list= list_add(field_list, &status);
field_list= list_add(field_list, &name);
@@ -210,10 +241,21 @@ int Show_instance_status::execute(struct st_net *net,
store_to_protocol_packet(&send_buff, (char*) "offline", &position);
if (instance->options.mysqld_version)
+ {
+ char parsed_version[MAX_VERSION_LENGTH];
+
+ parse_version_number(instance->options.mysqld_version, parsed_version,
+ sizeof(parsed_version));
+ store_to_protocol_packet(&send_buff, parsed_version, &position);
+
store_to_protocol_packet(&send_buff, instance->options.mysqld_version,
&position);
+ }
else
+ {
store_to_protocol_packet(&send_buff, (char*) "unknown", &position);
+ store_to_protocol_packet(&send_buff, (char*) "unknown", &position);
+ }
if (send_buff.is_error() ||
@@ -483,7 +525,7 @@ int Show_instance_log::execute(struct st_net *net, ulong connection_id)
read_buff.reserve(0, buff_size);
/* read in one chunk */
- read_len= my_seek(fd, file_stat.st_size - size, MY_SEEK_SET, MYF(0));
+ read_len= (int)my_seek(fd, file_stat.st_size - size, MY_SEEK_SET, MYF(0));
if ((read_len= my_read(fd, (byte*) read_buff.buffer,
buff_size, MYF(0))) < 0)
diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc
index 3d04403f830..39381b457ab 100644
--- a/server-tools/instance-manager/instance.cc
+++ b/server-tools/instance-manager/instance.cc
@@ -418,6 +418,10 @@ bool Instance::is_running()
if (options.mysqld_socket)
socket= strchr(options.mysqld_socket, '=') + 1;
+ /* no port was specified => instance falled back to default value */
+ if (!options.mysqld_port && !options.mysqld_socket)
+ port= SERVER_DEFAULT_PORT;
+
pthread_mutex_lock(&LOCK_instance);
mysql_init(&mysql);
diff --git a/server-tools/instance-manager/instance_map.cc b/server-tools/instance-manager/instance_map.cc
index 611eda457f2..7dfe0ae688b 100644
--- a/server-tools/instance-manager/instance_map.cc
+++ b/server-tools/instance-manager/instance_map.cc
@@ -229,11 +229,33 @@ int Instance_map::load()
uint args_used= 0;
const char *argv_options[3];
char **argv= (char **) &argv_options;
-
+ char defaults_file_arg[FN_REFLEN];
/* the name of the program may be orbitrary here in fact */
argv_options[0]= "mysqlmanager";
- argv_options[1]= '\0';
+
+ /*
+ If the option file was forced by the user when starting
+ the IM with --defaults-file=xxxx, make sure it is also
+ passed as --defaults-file, not only as Options::config_file.
+ This is important for option files given with relative path:
+ e.g. --defaults-file=my.cnf.
+ Otherwise my_search_option_files will treat "my.cnf" as a group
+ name and start looking for files named "my.cnf.cnf" in all
+ default dirs. Which is not what we want.
+ */
+ if (Options::is_forced_default_file)
+ {
+ snprintf(defaults_file_arg, FN_REFLEN, "--defaults-file=%s",
+ Options::config_file);
+
+ argv_options[1]= defaults_file_arg;
+ argv_options[2]= '\0';
+
+ argc= 2;
+ }
+ else
+ argv_options[1]= '\0';
/*
If the routine failed, we'll simply fallback to defaults in
diff --git a/server-tools/instance-manager/instance_options.cc b/server-tools/instance-manager/instance_options.cc
index 83f13b34aa2..d2946270b9e 100644
--- a/server-tools/instance-manager/instance_options.cc
+++ b/server-tools/instance-manager/instance_options.cc
@@ -138,9 +138,14 @@ int Instance_options::fill_instance_version()
if (*result != '\0')
{
+ char *start;
/* chop the newline from the end of the version string */
result[strlen(result) - NEWLINE_LEN]= '\0';
- mysqld_version= strdup_root(&alloc, result);
+ /* trim leading whitespaces */
+ start= result;
+ while (my_isspace(default_charset_info, *start))
+ ++start;
+ mysqld_version= strdup_root(&alloc, start);
}
err:
return rc;
@@ -167,8 +172,6 @@ err:
int Instance_options::fill_log_options()
{
Buffer buff;
- uint position= 0;
- char **tmp_argv= argv;
enum { MAX_LOG_OPTION_LENGTH= 256 };
char datadir[MAX_LOG_OPTION_LENGTH];
char hostname[MAX_LOG_OPTION_LENGTH];
diff --git a/server-tools/instance-manager/mysqlmanager.cc b/server-tools/instance-manager/mysqlmanager.cc
index 3d2907f4776..d0b2cf2666c 100644
--- a/server-tools/instance-manager/mysqlmanager.cc
+++ b/server-tools/instance-manager/mysqlmanager.cc
@@ -82,12 +82,13 @@ int main(int argc, char *argv[])
int return_value= 1;
init_environment(argv[0]);
Options options;
- struct passwd *user_info;
if (options.load(argc, argv))
goto err;
#ifndef __WIN__
+ struct passwd *user_info;
+
if ((user_info= check_user(options.user)))
{
if (set_user(options.user, user_info))
diff --git a/server-tools/instance-manager/options.cc b/server-tools/instance-manager/options.cc
index b16fcabae01..8119e8fc0ea 100644
--- a/server-tools/instance-manager/options.cc
+++ b/server-tools/instance-manager/options.cc
@@ -55,6 +55,8 @@ uint Options::monitoring_interval= DEFAULT_MONITORING_INTERVAL;
uint Options::port_number= DEFAULT_PORT;
/* just to declare */
char **Options::saved_argv= NULL;
+/* Remember if the config file was forced */
+bool Options::is_forced_default_file= 0;
/*
List of options, accepted by the instance manager.
@@ -118,7 +120,7 @@ static struct my_option my_long_options[] =
" Server binary.",
(gptr *) &Options::default_mysqld_path,
(gptr *) &Options::default_mysqld_path,
- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 },
{ "monitoring-interval", OPT_MONITORING_INTERVAL, "Interval to monitor"
" instances in seconds.",
@@ -254,6 +256,7 @@ int Options::load(int argc, char **argv)
if (is_prefix(argv[1], "--defaults-file="))
{
Options::config_file= strchr(argv[1], '=') + 1;
+ Options::is_forced_default_file= 1;
}
if (is_prefix(argv[1], "--defaults-extra-file=") ||
is_prefix(argv[1], "--no-defaults"))
diff --git a/server-tools/instance-manager/options.h b/server-tools/instance-manager/options.h
index 6d719c69629..abb094eac93 100644
--- a/server-tools/instance-manager/options.h
+++ b/server-tools/instance-manager/options.h
@@ -36,6 +36,7 @@ struct Options
static char run_as_service; /* handle_options doesn't support bool */
static const char *user;
#endif
+ static bool is_forced_default_file;
static const char *log_file_name;
static const char *pid_file_name;
static const char *socket_file_name;
diff --git a/server-tools/instance-manager/parse.cc b/server-tools/instance-manager/parse.cc
index a79a6ad6742..9d9064240d4 100644
--- a/server-tools/instance-manager/parse.cc
+++ b/server-tools/instance-manager/parse.cc
@@ -166,7 +166,8 @@ Command *parse_command(Instance_map *map, const char *text)
skip= true;
case TOK_SET:
- get_text_id(&text, &instance_name_len, &instance_name);
+ if (get_text_id(&text, &instance_name_len, &instance_name))
+ goto syntax_error;
text+= instance_name_len;
/* the next token should be a dot */
@@ -221,7 +222,8 @@ Command *parse_command(Instance_map *map, const char *text)
switch (Token tok2= shift_token(&text, &word_len)) {
case TOK_OPTIONS:
case TOK_STATUS:
- get_text_id(&text, &instance_name_len, &instance_name);
+ if (get_text_id(&text, &instance_name_len, &instance_name))
+ goto syntax_error;
text+= instance_name_len;
/* check that this is the end of the command */
get_word(&text, &word_len);
@@ -273,7 +275,8 @@ Command *parse_command(Instance_map *map, const char *text)
goto syntax_error;
}
/* get the size of the log we want to retrieve */
- get_text_id(&text, &word_len, &log_size);
+ if (get_text_id(&text, &word_len, &log_size))
+ goto syntax_error;
text+= word_len;
/* this parameter is required */
if (!word_len)
@@ -291,7 +294,6 @@ Command *parse_command(Instance_map *map, const char *text)
instance_name_len, log_type,
log_size, text);
- //get_text_id(&text, &log_size_len, &log_size);
break;
case '\0':
command= new Show_instance_log(map, instance_name,
diff --git a/server-tools/instance-manager/portability.h b/server-tools/instance-manager/portability.h
index 2bdeff71a72..1a3be5705e3 100644
--- a/server-tools/instance-manager/portability.h
+++ b/server-tools/instance-manager/portability.h
@@ -8,13 +8,12 @@
#ifdef __WIN__
#define vsnprintf _vsnprintf
+#define snprintf _snprintf
#define SIGKILL 9
#define SHUT_RDWR 0x2
/*TODO: fix this */
-#define DEFAULT_MONITORING_INTERVAL 20
-#define DEFAULT_PORT 2273
#define PROTOCOL_VERSION 10
typedef int pid_t;
diff --git a/server-tools/instance-manager/priv.cc b/server-tools/instance-manager/priv.cc
index e39c12f4ebb..d2d6a3f636c 100644
--- a/server-tools/instance-manager/priv.cc
+++ b/server-tools/instance-manager/priv.cc
@@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include
+#include
#include "priv.h"
#include "portability.h"
@@ -52,7 +53,7 @@ unsigned long net_buffer_length= 16384;
unsigned long max_allowed_packet= 16384;
-unsigned long net_read_timeout= 30; // same as in mysqld
+unsigned long net_read_timeout= NET_WAIT_TIMEOUT; // same as in mysqld
unsigned long net_write_timeout= 60; // same as in mysqld
diff --git a/server-tools/instance-manager/priv.h b/server-tools/instance-manager/priv.h
index 4739bca68eb..af6d2837933 100644
--- a/server-tools/instance-manager/priv.h
+++ b/server-tools/instance-manager/priv.h
@@ -24,6 +24,11 @@
#endif
#include "my_pthread.h"
+/* IM-wide platform-independent defines */
+#define SERVER_DEFAULT_PORT 3306
+#define DEFAULT_MONITORING_INTERVAL 20
+#define DEFAULT_PORT 2273
+
/* the pid of the manager process (of the signal thread on the LinuxThreads) */
extern pid_t manager_pid;
diff --git a/sql/event.cc b/sql/event.cc
index abca622835a..a7c6d48b988 100644
--- a/sql/event.cc
+++ b/sql/event.cc
@@ -704,11 +704,17 @@ done:
}
+/*
+ 0 - OK can drop from outside
+ 1 - Scheduled from dropping, don't drop from outside
+*/
+
static int
evex_remove_from_cache(LEX_STRING *db, LEX_STRING *name, bool use_lock,
bool is_drop)
{
uint i;
+ int ret= 0;
DBUG_ENTER("evex_remove_from_cache");
/*
@@ -738,7 +744,8 @@ evex_remove_from_cache(LEX_STRING *db, LEX_STRING *name, bool use_lock,
DBUG_PRINT("evex_remove_from_cache",
("running.defer mem free. is_drop=%d", is_drop));
et->flags|= EVENT_EXEC_NO_MORE;
- et->dropped= is_drop;
+ if ((et->dropped= is_drop))
+ ret= 1;
}
DBUG_PRINT("evex_remove_from_cache", ("delete from queue"));
evex_queue_delete_element(&EVEX_EQ_NAME, i);
@@ -751,7 +758,7 @@ done:
if (use_lock)
VOID(pthread_mutex_unlock(&LOCK_event_arrays));
- DBUG_RETURN(0);
+ DBUG_RETURN(ret);
}
@@ -866,21 +873,25 @@ done:
Drops an event
SYNOPSIS
- evex_drop_event()
+ db_drop_event()
thd THD
et event's name
drop_if_exists if set and the event not existing => warning onto the stack
+ rows_affected affected number of rows is returned heres
*/
-int
-evex_drop_event(THD *thd, event_timed *et, bool drop_if_exists,
- uint *rows_affected)
+int db_drop_event(THD *thd, event_timed *et, bool drop_if_exists,
+ uint *rows_affected)
{
TABLE *table;
- int ret= EVEX_OPEN_TABLE_FAILED;
- DBUG_ENTER("evex_drop_event");
+ Open_tables_state backup;
+ uint ret;
+ DBUG_ENTER("db_drop_event");
+ ret= EVEX_OPEN_TABLE_FAILED;
+
+ thd->reset_n_backup_open_tables_state(&backup);
if (evex_open_event_table(thd, TL_WRITE, &table))
{
my_error(ER_EVENT_OPEN_TABLE_FAILED, MYF(0));
@@ -908,10 +919,6 @@ evex_drop_event(THD *thd, event_timed *et, bool drop_if_exists,
goto done;
}
- VOID(pthread_mutex_lock(&LOCK_evex_running));
- if (evex_is_running)
- ret= evex_remove_from_cache(&et->dbname, &et->name, true, true);
- VOID(pthread_mutex_unlock(&LOCK_evex_running));
done:
/*
@@ -919,6 +926,44 @@ done:
we have to close our thread tables.
*/
close_thread_tables(thd);
+ thd->restore_backup_open_tables_state(&backup);
+ DBUG_RETURN(ret);
+}
+
+
+/*
+ Drops an event
+
+ SYNOPSIS
+ evex_drop_event()
+ thd THD
+ et event's name
+ drop_if_exists if set and the event not existing => warning onto the stack
+ rows_affected affected number of rows is returned heres
+
+*/
+
+int
+evex_drop_event(THD *thd, event_timed *et, bool drop_if_exists,
+ uint *rows_affected)
+{
+ TABLE *table;
+ int ret= 0;
+
+ DBUG_ENTER("evex_drop_event");
+
+
+ VOID(pthread_mutex_lock(&LOCK_evex_running));
+ if (evex_is_running)
+ ret= evex_remove_from_cache(&et->dbname, &et->name, true, true);
+ VOID(pthread_mutex_unlock(&LOCK_evex_running));
+
+ if (ret == 1)
+ ret= 0;
+ else if (ret == 0)
+ ret= db_drop_event(thd, et, drop_if_exists, rows_affected);
+ else
+ my_error(ER_UNKNOWN_ERROR, MYF(0));
DBUG_RETURN(ret);
}
diff --git a/sql/event_executor.cc b/sql/event_executor.cc
index 7960f1e1758..d06e3e57a1e 100644
--- a/sql/event_executor.cc
+++ b/sql/event_executor.cc
@@ -31,6 +31,7 @@
extern ulong thread_created;
extern const char *my_localhost;
+extern pthread_attr_t connection_attrib;
pthread_mutex_t LOCK_event_arrays,
LOCK_workers_count,
@@ -41,7 +42,7 @@ bool evex_is_running= false;
ulonglong evex_main_thread_id= 0;
ulong opt_event_executor;
-volatile my_bool event_executor_running_global_var;
+my_bool event_executor_running_global_var;
static my_bool evex_mutexes_initted= false;
static uint workers_count;
@@ -102,7 +103,7 @@ init_events()
{
#ifndef DBUG_FAULTY_THR
//TODO Andrey: Change the error code returned!
- if (pthread_create(&th, NULL, event_executor_main, (void*)NULL))
+ if (pthread_create(&th, &connection_attrib, event_executor_main,(void*)NULL))
DBUG_RETURN(ER_SLAVE_THREAD);
#else
event_executor_main(NULL);
@@ -351,7 +352,7 @@ event_executor_main(void *arg)
++iter_num;
DBUG_PRINT("info", (" Spawning a thread %d", iter_num));
#ifndef DBUG_FAULTY_THR
- if (pthread_create(&th, NULL, event_executor_worker, (void*)et))
+ if (pthread_create(&th,&connection_attrib,event_executor_worker,(void*)et))
{
sql_print_error("Problem while trying to create a thread");
UNLOCK_MUTEX_AND_BAIL_OUT(LOCK_event_arrays, err);
diff --git a/sql/event_priv.h b/sql/event_priv.h
index 7d1cdbcd264..b0ba205d806 100644
--- a/sql/event_priv.h
+++ b/sql/event_priv.h
@@ -40,6 +40,9 @@ evex_db_find_event_aux(THD *thd, const LEX_STRING dbname,
int
event_timed_compare_q(void *vptr, byte* a, byte *b);
+int db_drop_event(THD *thd, event_timed *et, bool drop_if_exists,
+ uint *rows_affected);
+
#define EXEC_QUEUE_QUEUE_NAME executing_queue
#define EXEC_QUEUE_DARR_NAME evex_executing_queue
diff --git a/sql/event_timed.cc b/sql/event_timed.cc
index 28d21089b74..e585f6252ca 100644
--- a/sql/event_timed.cc
+++ b/sql/event_timed.cc
@@ -877,20 +877,10 @@ int
event_timed::drop(THD *thd)
{
TABLE *table;
- int ret= 0;
+ uint tmp= 0;
DBUG_ENTER("event_timed::drop");
- if (evex_open_event_table(thd, TL_WRITE, &table))
- DBUG_RETURN(-1);
-
- if (evex_db_find_event_aux(thd, dbname, name, definer, table))
- DBUG_RETURN(-2);
-
- if ((ret= table->file->ha_delete_row(table->record[0])))
- DBUG_RETURN(ret);
-
- close_thread_tables(thd);
- DBUG_RETURN(0);
+ DBUG_RETURN(db_drop_event(thd, this, false, &tmp));
}
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index eaf52a9ca09..0002ab0123f 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -465,6 +465,10 @@ convert_error_code_to_mysql(
return(HA_ERR_FOUND_DUPP_KEY);
+ } else if (error == (int) DB_FOREIGN_DUPLICATE_KEY) {
+
+ return(HA_ERR_FOREIGN_DUPLICATE_KEY);
+
} else if (error == (int) DB_RECORD_NOT_FOUND) {
return(HA_ERR_NO_ACTIVE_RECORD);
@@ -5757,7 +5761,7 @@ ha_innobase::analyze(
}
/**************************************************************************
-This is mapped to "ALTER TABLE tablename TYPE=InnoDB", which rebuilds
+This is mapped to "ALTER TABLE tablename ENGINE=InnoDB", which rebuilds
the table in MySQL. */
int
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 5f0adba6e8c..4b84d3efa7f 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -1381,10 +1381,6 @@ void ha_myisam::info(uint flag)
if (share->tmp_table == NO_TMP_TABLE)
pthread_mutex_unlock(&share->mutex);
- raid_type= info.raid_type;
- raid_chunks= info.raid_chunks;
- raid_chunksize= info.raid_chunksize;
-
/*
Set data_file_name and index_file_name to point at the symlink value
if table is symlinked (Ie; Real name is not same as generated name)
@@ -1461,12 +1457,6 @@ void ha_myisam::update_create_info(HA_CREATE_INFO *create_info)
{
create_info->auto_increment_value=auto_increment_value;
}
- if (!(create_info->used_fields & HA_CREATE_USED_RAID))
- {
- create_info->raid_type= raid_type;
- create_info->raid_chunks= raid_chunks;
- create_info->raid_chunksize= raid_chunksize;
- }
create_info->data_file_name=data_file_name;
create_info->index_file_name=index_file_name;
}
@@ -1658,11 +1648,6 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
(ulonglong) 0);
create_info.data_file_length= ((ulonglong) share->max_rows *
share->avg_row_length);
- create_info.raid_type=info->raid_type;
- create_info.raid_chunks= (info->raid_chunks ? info->raid_chunks :
- RAID_DEFAULT_CHUNKS);
- create_info.raid_chunksize= (info->raid_chunksize ? info->raid_chunksize :
- RAID_DEFAULT_CHUNKSIZE);
create_info.data_file_name= info->data_file_name;
create_info.index_file_name= info->index_file_name;
@@ -1787,9 +1772,6 @@ bool ha_myisam::check_if_incompatible_data(HA_CREATE_INFO *info,
uint options= table->s->db_options_in_use;
if (info->auto_increment_value != auto_increment_value ||
- info->raid_type != raid_type ||
- info->raid_chunks != raid_chunks ||
- info->raid_chunksize != raid_chunksize ||
info->data_file_name != data_file_name ||
info->index_file_name != index_file_name ||
table_changes == IS_EQUAL_NO)
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index f1fdfe86930..bd11b72dd64 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -69,7 +69,7 @@ handlerton ndbcluster_hton = {
MYSQL_HANDLERTON_INTERFACE_VERSION,
"ndbcluster",
SHOW_OPTION_YES,
- "Clustered, fault-tolerant, memory-based tables",
+ "Clustered, fault-tolerant tables",
DB_TYPE_NDBCLUSTER,
ndbcluster_init,
~(uint)0, /* slot */
@@ -97,8 +97,6 @@ static uint ndbcluster_alter_table_flags(uint flags)
}
-#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8
-
#define NDB_FAILED_AUTO_INCREMENT ~(Uint64)0
#define NDB_AUTO_INCREMENT_RETRIES 10
@@ -952,7 +950,7 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field,
}
// Used for hidden key only
- m_value[fieldnr].rec= ndb_op->getValue(fieldnr, NULL);
+ m_value[fieldnr].rec= ndb_op->getValue(fieldnr, m_ref);
DBUG_RETURN(m_value[fieldnr].rec == NULL);
}
@@ -2551,13 +2549,10 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
DBUG_PRINT("info", ("Using hidden key"));
// Require that the PK for this record has previously been
- // read into m_value
- uint no_fields= table_share->fields;
- const NdbRecAttr* rec= m_value[no_fields].rec;
- DBUG_ASSERT(rec);
- DBUG_DUMP("key", (char*)rec->aRef(), NDB_HIDDEN_PRIMARY_KEY_LENGTH);
+ // read into m_ref
+ DBUG_DUMP("key", m_ref, NDB_HIDDEN_PRIMARY_KEY_LENGTH);
- if (set_hidden_key(op, no_fields, rec->aRef()))
+ if (set_hidden_key(op, table->s->fields, m_ref))
ERR_RETURN(op->getNdbError());
}
else
@@ -2664,11 +2659,8 @@ int ha_ndbcluster::delete_row(const byte *record)
{
// This table has no primary key, use "hidden" primary key
DBUG_PRINT("info", ("Using hidden key"));
- uint no_fields= table_share->fields;
- const NdbRecAttr* rec= m_value[no_fields].rec;
- DBUG_ASSERT(rec != NULL);
- if (set_hidden_key(op, no_fields, rec->aRef()))
+ if (set_hidden_key(op, table->s->fields, m_ref))
ERR_RETURN(op->getNdbError());
}
else
@@ -3242,17 +3234,15 @@ void ha_ndbcluster::position(const byte *record)
{
// No primary key, get hidden key
DBUG_PRINT("info", ("Getting hidden key"));
- int hidden_no= table_share->fields;
- const NdbRecAttr* rec= m_value[hidden_no].rec;
- memcpy(ref, (const void*)rec->aRef(), ref_length);
#ifndef DBUG_OFF
+ int hidden_no= table->s->fields;
const NDBTAB *tab= (const NDBTAB *) m_table;
const NDBCOL *hidden_col= tab->getColumn(hidden_no);
DBUG_ASSERT(hidden_col->getPrimaryKey() &&
hidden_col->getAutoIncrement() &&
- rec != NULL &&
ref_length == NDB_HIDDEN_PRIMARY_KEY_LENGTH);
#endif
+ memcpy(ref, m_ref, ref_length);
}
DBUG_DUMP("ref", (char*)ref, ref_length);
@@ -6199,6 +6189,10 @@ uint ha_ndbcluster::max_supported_key_length() const
{
return NDB_MAX_KEY_SIZE;
}
+uint ha_ndbcluster::max_supported_key_part_length() const
+{
+ return NDB_MAX_KEY_SIZE;
+}
bool ha_ndbcluster::low_byte_first() const
{
#ifdef WORDS_BIGENDIAN
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index f12b6198a68..12a5be32881 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -31,6 +31,8 @@
#include
#include
+#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8
+
class Ndb; // Forward declaration
class NdbOperation; // Forward declaration
class NdbTransaction; // Forward declaration
@@ -604,6 +606,7 @@ class ha_ndbcluster: public handler
uint max_supported_keys() const;
uint max_supported_key_parts() const;
uint max_supported_key_length() const;
+ uint max_supported_key_part_length() const;
int rename_table(const char *from, const char *to);
int delete_table(const char *name);
@@ -817,6 +820,7 @@ private:
NDB_INDEX_DATA m_index[MAX_KEY];
// NdbRecAttr has no reference to blob
NdbValue m_value[NDB_MAX_ATTRIBUTES_IN_TABLE];
+ byte m_ref[NDB_HIDDEN_PRIMARY_KEY_LENGTH];
partition_info *m_part_info;
byte *m_rec0;
Field **m_part_field_array;
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 2bc4a106536..0bd300df2e2 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -4284,9 +4284,6 @@ void ha_partition::info(uint flag)
sortkey: Never used at any place so ignored
ref_length: We set this to the value calculated
and stored in local object
- raid_type: Set by first handler (MyISAM)
- raid_chunks: Set by first handler (MyISAM)
- raid_chunksize: Set by first handler (MyISAM)
create_time: Creation time of table
Set by first handler
@@ -4297,9 +4294,6 @@ void ha_partition::info(uint flag)
file= m_file[0];
file->info(HA_STATUS_CONST);
create_time= file->create_time;
- raid_type= file->raid_type;
- raid_chunks= file->raid_chunks;
- raid_chunksize= file->raid_chunksize;
ref_length= m_ref_length;
}
if (flag & HA_STATUS_ERRKEY)
diff --git a/sql/handler.cc b/sql/handler.cc
index 24e9f6aa1e2..dc7ec37a23d 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -358,6 +358,7 @@ static int ha_init_errors(void)
SETMSG(HA_ERR_TABLE_EXIST, ER(ER_TABLE_EXISTS_ERROR));
SETMSG(HA_ERR_NO_CONNECTION, "Could not connect to storage engine");
SETMSG(HA_ERR_TABLE_DEF_CHANGED, ER(ER_TABLE_DEF_CHANGED));
+ SETMSG(HA_ERR_FOREIGN_DUPLICATE_KEY, "FK constraint would lead to duplicate key");
/* Register the error messages for use with my_error(). */
return my_error_register(errmsgs, HA_ERR_FIRST, HA_ERR_LAST);
@@ -1857,17 +1858,35 @@ void handler::print_error(int error, myf errflag)
str.length(max_length-4);
str.append(STRING_WITH_LEN("..."));
}
-#ifdef XXX_TO_BE_DONE_BY_A_FOLLOWUP_OF_WL1563
- my_printf_error(ER_DUP_ENTRY, "Duplicate entry '%s' for key '%s'",
- MYF(0), str.c_ptr(), table->key_info[key_nr].name);
-#else
- my_error(ER_DUP_ENTRY, MYF(0), str.c_ptr(), key_nr+1);
-#endif
+ my_error(ER_DUP_ENTRY, MYF(0), str.c_ptr(), table->key_info[key_nr].name);
DBUG_VOID_RETURN;
}
textno=ER_DUP_KEY;
break;
}
+ case HA_ERR_FOREIGN_DUPLICATE_KEY:
+ {
+ uint key_nr= get_dup_key(error);
+ if ((int) key_nr >= 0)
+ {
+ /* Write the key in the error message */
+ char key[MAX_KEY_LENGTH];
+ String str(key,sizeof(key),system_charset_info);
+ /* Table is opened and defined at this point */
+ key_unpack(&str,table,(uint) key_nr);
+ uint max_length= MYSQL_ERRMSG_SIZE-(uint) strlen(ER(ER_FOREIGN_DUPLICATE_KEY));
+ if (str.length() >= max_length)
+ {
+ str.length(max_length-4);
+ str.append(STRING_WITH_LEN("..."));
+ }
+ my_error(ER_FOREIGN_DUPLICATE_KEY, MYF(0), table_share->table_name.str,
+ str.c_ptr(), key_nr+1);
+ DBUG_VOID_RETURN;
+ }
+ textno= ER_DUP_KEY;
+ break;
+ }
case HA_ERR_NULL_IN_SPATIAL:
textno= ER_UNKNOWN_ERROR;
break;
@@ -2003,8 +2022,9 @@ uint handler::get_dup_key(int error)
{
DBUG_ENTER("handler::get_dup_key");
table->file->errkey = (uint) -1;
- if (error == HA_ERR_FOUND_DUPP_KEY || error == HA_ERR_FOUND_DUPP_UNIQUE ||
- error == HA_ERR_NULL_IN_SPATIAL || error == HA_ERR_DROP_INDEX_FK)
+ if (error == HA_ERR_FOUND_DUPP_KEY || error == HA_ERR_FOREIGN_DUPLICATE_KEY ||
+ error == HA_ERR_FOUND_DUPP_UNIQUE || error == HA_ERR_NULL_IN_SPATIAL ||
+ error == HA_ERR_DROP_INDEX_FK)
info(HA_STATUS_ERRKEY | HA_STATUS_NO_LOCK);
DBUG_RETURN(table->file->errkey);
}
diff --git a/sql/handler.h b/sql/handler.h
index 92fa581c19c..a8804bdba17 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -266,7 +266,7 @@ enum enum_binlog_command {
/* Bits in used_fields */
#define HA_CREATE_USED_AUTO (1L << 0)
-#define HA_CREATE_USED_RAID (1L << 1)
+#define HA_CREATE_USED_RAID (1L << 1) //RAID is no longer availble
#define HA_CREATE_USED_UNION (1L << 2)
#define HA_CREATE_USED_INSERT_METHOD (1L << 3)
#define HA_CREATE_USED_MIN_ROWS (1L << 4)
@@ -1068,14 +1068,12 @@ typedef struct st_ha_create_information
ulonglong auto_increment_value;
ulong table_options;
ulong avg_row_length;
- ulong raid_chunksize;
ulong used_fields;
SQL_LIST merge_list;
handlerton *db_type;
enum row_type row_type;
uint null_bits; /* NULL bits at start of record */
uint options; /* OR of HA_CREATE_ options */
- uint raid_type,raid_chunks;
uint merge_insert_method;
uint extra_size; /* length of extra data segment */
bool table_existed; /* 1 in create if table existed */
@@ -1204,7 +1202,6 @@ public:
ulonglong auto_increment_value;
ha_rows records; /* Records in table */
ha_rows deleted; /* Deleted records */
- ulong raid_chunksize;
ulong mean_rec_length; /* physical reclength */
time_t create_time; /* When table was created */
time_t check_time;
@@ -1228,7 +1225,6 @@ public:
/* Length of ref (1-8 or the clustered key length) */
uint ref_length;
uint block_size; /* index block size */
- uint raid_type,raid_chunks;
FT_INFO *ft_handler;
enum {NONE=0, INDEX, RND} inited;
bool auto_increment_column_changed;
@@ -1245,7 +1241,7 @@ public:
create_time(0), check_time(0), update_time(0),
key_used_on_scan(MAX_KEY), active_index(MAX_KEY),
ref_length(sizeof(my_off_t)), block_size(0),
- raid_type(0), ft_handler(0), inited(NONE), implicit_emptied(0),
+ ft_handler(0), inited(NONE), implicit_emptied(0),
pushed_cond(NULL)
{}
virtual ~handler(void)
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 60b0dafefc5..22200732861 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1865,28 +1865,30 @@ longlong Item_func_round::int_op()
return value; // integer have not digits after point
abs_dec= -dec;
- double tmp;
- /*
- tmp2 is here to avoid return the value with 80 bit precision
- This will fix that the test round(0.1,1) = round(0.1,1) is true
- */
- volatile double tmp2;
-
- tmp= (abs_dec < array_elements(log_10) ?
- log_10[abs_dec] : pow(10.0, (double) abs_dec));
-
+ longlong tmp;
+
+ if(abs_dec >= array_elements(log_10_int))
+ return 0;
+
+ tmp= log_10_int[abs_dec];
+
if (truncate)
{
if (unsigned_flag)
- tmp2= floor(ulonglong2double(value)/tmp)*tmp;
- else if (value >= 0)
- tmp2= floor(((double)value)/tmp)*tmp;
+ value= (ulonglong(value)/tmp)*tmp;
else
- tmp2= ceil(((double)value)/tmp)*tmp;
+ value= (value/tmp)*tmp;
}
else
- tmp2= rint(((double)value)/tmp)*tmp;
- return (longlong)tmp2;
+ {
+ if (unsigned_flag)
+ value= ((ulonglong(value)+(tmp>>1))/tmp)*tmp;
+ else if ( value >= 0)
+ value= ((value+(tmp>>1))/tmp)*tmp;
+ else
+ value= ((value-(tmp>>1))/tmp)*tmp;
+ }
+ return value;
}
diff --git a/sql/item_func.h b/sql/item_func.h
index d81eb5f6ebf..d8fa45fb9c0 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1283,10 +1283,8 @@ public:
DBUG_ENTER("Item_func_match");
Item_real_func::cleanup();
if (!master && ft_handler)
- {
ft_handler->please->close_search(ft_handler);
- ft_handler=0;
- }
+ ft_handler= 0;
concat= 0;
DBUG_VOID_RETURN;
}
diff --git a/sql/lex.h b/sql/lex.h
index 3dfaa0cf6cb..b52be29457f 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -410,10 +410,6 @@ static SYMBOL symbols[] = {
{ "QUARTER", SYM(QUARTER_SYM)},
{ "QUERY", SYM(QUERY_SYM)},
{ "QUICK", SYM(QUICK)},
- { "RAID0", SYM(RAID_0_SYM)},
- { "RAID_CHUNKS", SYM(RAID_CHUNKS)},
- { "RAID_CHUNKSIZE", SYM(RAID_CHUNKSIZE)},
- { "RAID_TYPE", SYM(RAID_TYPE)},
{ "RANGE", SYM(RANGE_SYM)},
{ "READ", SYM(READ_SYM)},
{ "READ_ONLY", SYM(READ_ONLY_SYM)},
@@ -512,7 +508,6 @@ static SYMBOL symbols[] = {
{ "STORAGE", SYM(STORAGE_SYM)},
{ "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN)},
{ "STRING", SYM(STRING_SYM)},
- { "STRIPED", SYM(RAID_STRIPED_SYM)},
{ "SUBJECT", SYM(SUBJECT_SYM)},
{ "SUBPARTITION", SYM(SUBPARTITION_SYM)},
{ "SUBPARTITIONS", SYM(SUBPARTITIONS_SYM)},
diff --git a/sql/log.cc b/sql/log.cc
index bb93c741dd9..a7e6a3da7f6 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -311,7 +311,8 @@ bool Log_to_csv_event_handler::
log_general(time_t event_time, const char *user_host,
uint user_host_len, int thread_id,
const char *command_type, uint command_type_len,
- const char *sql_text, uint sql_text_len)
+ const char *sql_text, uint sql_text_len,
+ CHARSET_INFO *client_cs)
{
TABLE *table= general_log.table;
@@ -326,11 +327,11 @@ bool Log_to_csv_event_handler::
/* set default value (which is CURRENT_TIMESTAMP) */
table->field[0]->set_null();
- table->field[1]->store(user_host, user_host_len, &my_charset_latin1);
+ table->field[1]->store(user_host, user_host_len, client_cs);
table->field[2]->store((longlong) thread_id);
table->field[3]->store((longlong) server_id);
- table->field[4]->store(command_type, command_type_len, &my_charset_latin1);
- table->field[5]->store(sql_text, sql_text_len, &my_charset_latin1);
+ table->field[4]->store(command_type, command_type_len, client_cs);
+ table->field[5]->store(sql_text, sql_text_len, client_cs);
table->file->ha_write_row(table->record[0]);
reenable_binlog(current_thd);
@@ -376,6 +377,7 @@ bool Log_to_csv_event_handler::
{
/* table variables */
TABLE *table= slow_log.table;
+ CHARSET_INFO *client_cs= thd->variables.character_set_client;
DBUG_ENTER("log_slow_to_csv");
@@ -396,7 +398,7 @@ bool Log_to_csv_event_handler::
table->field[0]->set_null();
/* store the value */
- table->field[1]->store(user_host, user_host_len, &my_charset_latin1);
+ table->field[1]->store(user_host, user_host_len, client_cs);
if (query_start_arg)
{
@@ -419,7 +421,7 @@ bool Log_to_csv_event_handler::
if (thd->db)
/* fill database field */
- table->field[6]->store(thd->db, thd->db_length, &my_charset_latin1);
+ table->field[6]->store(thd->db, thd->db_length, client_cs);
else
table->field[6]->set_null();
@@ -437,8 +439,7 @@ bool Log_to_csv_event_handler::
table->field[9]->store((longlong) server_id);
/* sql_text */
- table->field[10]->store(sql_text,sql_text_len,
- &my_charset_latin1);
+ table->field[10]->store(sql_text,sql_text_len, client_cs);
/* write the row */
table->file->ha_write_row(table->record[0]);
@@ -494,7 +495,8 @@ bool Log_to_file_event_handler::
log_general(time_t event_time, const char *user_host,
uint user_host_len, int thread_id,
const char *command_type, uint command_type_len,
- const char *sql_text, uint sql_text_len)
+ const char *sql_text, uint sql_text_len,
+ CHARSET_INFO *client_cs)
{
return mysql_log.write(event_time, user_host, user_host_len,
thread_id, command_type, command_type_len,
@@ -608,7 +610,7 @@ void LOGGER::init_base()
file_log_handler= new Log_to_file_event_handler;
/* by default we use traditional error log */
- init_error_log(LEGACY);
+ init_error_log(LOG_FILE);
file_log_handler->init_pthread_objects();
(void) pthread_mutex_init(&LOCK_logger, MY_MUTEX_INIT_SLOW);
@@ -810,47 +812,54 @@ bool LOGGER::general_log_print(THD *thd, enum enum_server_command command,
user_host_len, id,
command_name[(uint) command].str,
command_name[(uint) command].length,
- message_buff, message_buff_len) || error;
+ message_buff, message_buff_len,
+ thd->variables.character_set_client) || error;
unlock();
}
return error;
}
-void LOGGER::init_error_log(enum enum_printer error_log_printer)
+void LOGGER::init_error_log(uint error_log_printer)
{
- switch (error_log_printer) {
- case NONE:
+ if (error_log_printer & LOG_NONE)
+ {
error_log_handler_list[0]= 0;
- break;
- case LEGACY:
+ return;
+ }
+
+ switch (error_log_printer) {
+ case LOG_FILE:
error_log_handler_list[0]= file_log_handler;
error_log_handler_list[1]= 0;
break;
/* these two are disabled for now */
- case CSV:
+ case LOG_TABLE:
DBUG_ASSERT(0);
break;
- case LEGACY_AND_CSV:
+ case LOG_TABLE|LOG_FILE:
DBUG_ASSERT(0);
break;
}
}
-void LOGGER::init_slow_log(enum enum_printer slow_log_printer)
+void LOGGER::init_slow_log(uint slow_log_printer)
{
- switch (slow_log_printer) {
- case NONE:
+ if (slow_log_printer & LOG_NONE)
+ {
slow_log_handler_list[0]= 0;
- break;
- case LEGACY:
+ return;
+ }
+
+ switch (slow_log_printer) {
+ case LOG_FILE:
slow_log_handler_list[0]= file_log_handler;
slow_log_handler_list[1]= 0;
break;
- case CSV:
+ case LOG_TABLE:
slow_log_handler_list[0]= table_log_handler;
slow_log_handler_list[1]= 0;
break;
- case LEGACY_AND_CSV:
+ case LOG_TABLE|LOG_FILE:
slow_log_handler_list[0]= file_log_handler;
slow_log_handler_list[1]= table_log_handler;
slow_log_handler_list[2]= 0;
@@ -858,21 +867,24 @@ void LOGGER::init_slow_log(enum enum_printer slow_log_printer)
}
}
-void LOGGER::init_general_log(enum enum_printer general_log_printer)
+void LOGGER::init_general_log(uint general_log_printer)
{
- switch (general_log_printer) {
- case NONE:
+ if (general_log_printer & LOG_NONE)
+ {
general_log_handler_list[0]= 0;
- break;
- case LEGACY:
+ return;
+ }
+
+ switch (general_log_printer) {
+ case LOG_FILE:
general_log_handler_list[0]= file_log_handler;
general_log_handler_list[1]= 0;
break;
- case CSV:
+ case LOG_TABLE:
general_log_handler_list[0]= table_log_handler;
general_log_handler_list[1]= 0;
break;
- case LEGACY_AND_CSV:
+ case LOG_TABLE|LOG_FILE:
general_log_handler_list[0]= file_log_handler;
general_log_handler_list[1]= table_log_handler;
general_log_handler_list[2]= 0;
@@ -903,20 +915,20 @@ bool Log_to_csv_event_handler::init()
return (open_log_table(QUERY_LOG_GENERAL) || open_log_table(QUERY_LOG_SLOW));
}
-int LOGGER::set_handlers(enum enum_printer error_log_printer,
- enum enum_printer slow_log_printer,
- enum enum_printer general_log_printer)
+int LOGGER::set_handlers(uint error_log_printer,
+ uint slow_log_printer,
+ uint general_log_printer)
{
/* error log table is not supported yet */
- DBUG_ASSERT(error_log_printer < CSV);
+ DBUG_ASSERT(error_log_printer < LOG_TABLE);
lock();
- if ((slow_log_printer >= CSV || general_log_printer >= CSV) &&
+ if ((slow_log_printer & LOG_TABLE || general_log_printer & LOG_TABLE) &&
!is_log_tables_initialized)
{
- slow_log_printer= LEGACY;
- general_log_printer= LEGACY;
+ slow_log_printer= (slow_log_printer & ~LOG_TABLE) | LOG_FILE;
+ general_log_printer= (general_log_printer & ~LOG_TABLE) | LOG_FILE;
sql_print_error("Failed to initialize log tables. "
"Falling back to the old-fashioned logs");
diff --git a/sql/log.h b/sql/log.h
index 9868fe23292..98a86072fca 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -138,14 +138,10 @@ typedef struct st_log_info
*/
#define MAX_LOG_HANDLERS_NUM 3
-enum enum_printer
-{
- NONE,
- LEGACY,
- CSV,
- LEGACY_AND_CSV
-};
-
+/* log event handler flags */
+#define LOG_NONE 1
+#define LOG_FILE 2
+#define LOG_TABLE 4
class Log_event;
class Rows_log_event;
@@ -368,7 +364,8 @@ public:
virtual bool log_general(time_t event_time, const char *user_host,
uint user_host_len, int thread_id,
const char *command_type, uint command_type_len,
- const char *sql_text, uint sql_text_len)= 0;
+ const char *sql_text, uint sql_text_len,
+ CHARSET_INFO *client_cs)= 0;
virtual ~Log_event_handler() {}
};
@@ -403,7 +400,8 @@ public:
virtual bool log_general(time_t event_time, const char *user_host,
uint user_host_len, int thread_id,
const char *command_type, uint command_type_len,
- const char *sql_text, uint sql_text_len);
+ const char *sql_text, uint sql_text_len,
+ CHARSET_INFO *client_cs);
bool flush(THD *thd, TABLE_LIST *close_slow_Log,
TABLE_LIST* close_general_log);
void close_log_table(uint log_type, bool lock_in_use);
@@ -431,7 +429,8 @@ public:
virtual bool log_general(time_t event_time, const char *user_host,
uint user_host_len, int thread_id,
const char *command_type, uint command_type_len,
- const char *sql_text, uint sql_text_len);
+ const char *sql_text, uint sql_text_len,
+ CHARSET_INFO *client_cs);
void flush();
void init_pthread_objects();
};
@@ -500,12 +499,12 @@ public:
bool reopen_log_table(uint log_type);
/* we use this function to setup all enabled log event handlers */
- int set_handlers(enum enum_printer error_log_printer,
- enum enum_printer slow_log_printer,
- enum enum_printer general_log_printer);
- void init_error_log(enum enum_printer error_log_printer);
- void init_slow_log(enum enum_printer slow_log_printer);
- void init_general_log(enum enum_printer general_log_printer);
+ int set_handlers(uint error_log_printer,
+ uint slow_log_printer,
+ uint general_log_printer);
+ void init_error_log(uint error_log_printer);
+ void init_slow_log(uint slow_log_printer);
+ void init_general_log(uint general_log_printer);
};
#endif /* LOG_H */
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 29faefcabda..c9f8c2049c1 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -1305,7 +1305,6 @@ extern my_bool locked_in_memory;
extern bool opt_using_transactions, mysqld_embedded;
extern bool using_update_log, opt_large_files, server_id_supplied;
extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log, opt_error_log;
-extern bool opt_old_log_format;
extern bool opt_disable_networking, opt_skip_show_db;
extern my_bool opt_character_set_client_handshake;
extern bool volatile abort_loop, shutdown_in_progress, grant_option;
@@ -1432,7 +1431,6 @@ extern handlerton myisam_hton;
extern handlerton myisammrg_hton;
extern handlerton heap_hton;
-extern SHOW_COMP_OPTION have_isam;
extern SHOW_COMP_OPTION have_row_based_replication;
extern SHOW_COMP_OPTION have_raid, have_openssl, have_symlink;
extern SHOW_COMP_OPTION have_query_cache;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index be476c11533..a726e00c763 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -304,8 +304,16 @@ arg_cmp_func Arg_comparator::comparator_matrix[5][2] =
{&Arg_comparator::compare_row, &Arg_comparator::compare_e_row},
{&Arg_comparator::compare_decimal, &Arg_comparator::compare_e_decimal}};
+const char *log_output_names[] =
+{ "NONE", "FILE", "TABLE", NullS};
+TYPELIB log_output_typelib= {array_elements(log_output_names)-1,"",
+ log_output_names, NULL};
+
/* static variables */
+/* the default log output is log tables */
+static const char *log_output_str= "TABLE";
+static ulong log_output_options= LOG_TABLE;
static bool lower_case_table_names_used= 0;
static bool volatile select_thread_in_use, signal_thread_in_use;
static bool volatile ready_to_exit;
@@ -339,9 +347,6 @@ static my_bool opt_sync_bdb_logs;
bool opt_log, opt_update_log, opt_bin_log, opt_slow_log;
bool opt_error_log= IF_WIN(1,0);
-#ifdef WITH_CSV_STORAGE_ENGINE
-bool opt_old_log_format, opt_both_log_formats;
-#endif
bool opt_disable_networking=0, opt_skip_show_db=0;
my_bool opt_character_set_client_handshake= 1;
bool server_id_supplied = 0;
@@ -576,7 +581,7 @@ CHARSET_INFO *national_charset_info, *table_alias_charset;
CHARSET_INFO *character_set_filesystem;
SHOW_COMP_OPTION have_row_based_replication;
-SHOW_COMP_OPTION have_raid, have_openssl, have_symlink, have_query_cache;
+SHOW_COMP_OPTION have_openssl, have_symlink, have_query_cache;
SHOW_COMP_OPTION have_geometry, have_rtree_keys;
SHOW_COMP_OPTION have_crypt, have_compress;
@@ -1193,9 +1198,6 @@ void clean_up(bool print_message)
multi_keycache_free();
free_status_vars();
end_thr_alarm(1); /* Free allocated memory */
-#ifdef USE_RAID
- end_raid();
-#endif
my_free_open_file_info();
my_free((char*) global_system_variables.date_format,
MYF(MY_ALLOW_ZERO_PTR));
@@ -2405,8 +2407,8 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
sql_print_information("Got signal %d to shutdown mysqld",sig);
#endif
/* switch to the old log message processing */
- logger.set_handlers(LEGACY, opt_slow_log ? LEGACY:NONE,
- opt_log ? LEGACY:NONE);
+ logger.set_handlers(LOG_FILE, opt_slow_log ? LOG_FILE:LOG_NONE,
+ opt_log ? LOG_FILE:LOG_NONE);
DBUG_PRINT("info",("Got signal: %d abort_loop: %d",sig,abort_loop));
if (!abort_loop)
{
@@ -2435,8 +2437,8 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
(TABLE_LIST*) 0, ¬_used); // Flush logs
}
/* reenable logs after the options were reloaded */
- logger.set_handlers(LEGACY, opt_slow_log ? CSV:NONE,
- opt_log ? CSV:NONE);
+ logger.set_handlers(LOG_FILE, opt_slow_log ? LOG_TABLE:LOG_NONE,
+ opt_log ? LOG_TABLE:LOG_NONE);
break;
#ifdef USE_ONE_SIGNAL_HAND
case THR_SERVER_ALARM:
@@ -3094,25 +3096,38 @@ static int init_server_components()
#ifdef WITH_CSV_STORAGE_ENGINE
if (opt_bootstrap)
- opt_old_log_format= TRUE;
+ log_output_options= LOG_FILE;
else
logger.init_log_tables();
- if (opt_old_log_format || (have_csv_db != SHOW_OPTION_YES))
- logger.set_handlers(LEGACY, opt_slow_log ? LEGACY:NONE,
- opt_log ? LEGACY:NONE);
+ if (log_output_options & LOG_NONE)
+ {
+ /*
+ Issue a warining if there were specified additional options to the
+ log-output along with NONE. Probably this wasn't what user wanted.
+ */
+ if ((log_output_options & LOG_NONE) && (log_output_options & ~LOG_NONE))
+ sql_print_warning("There were other values specified to "
+ "log-output besides NONE. Disabling slow "
+ "and general logs anyway.");
+ logger.set_handlers(LOG_FILE, LOG_NONE, LOG_NONE);
+ }
else
- if (opt_both_log_formats)
- logger.set_handlers(LEGACY,
- opt_slow_log ? LEGACY_AND_CSV:NONE,
- opt_log ? LEGACY_AND_CSV:NONE);
- else
- /* the default is CSV log tables */
- logger.set_handlers(LEGACY, opt_slow_log ? CSV:NONE,
- opt_log ? CSV:NONE);
+ {
+ /* fall back to the log files if tables are not present */
+ if (have_csv_db == SHOW_OPTION_NO)
+ {
+ sql_print_error("CSV engine is not present, falling back to the "
+ "log files");
+ log_output_options= log_output_options & ~LOG_TABLE | LOG_FILE;
+ }
+
+ logger.set_handlers(LOG_FILE, opt_slow_log ? log_output_options:LOG_NONE,
+ opt_log ? log_output_options:LOG_NONE);
+ }
#else
- logger.set_handlers(LEGACY, opt_slow_log ? LEGACY:NONE,
- opt_log ? LEGACY:NONE);
+ logger.set_handlers(LOG_FILE, opt_slow_log ? LOG_FILE:LOG_NONE,
+ opt_log ? LOG_FILE:LOG_NONE);
#endif
if (opt_update_log)
@@ -4692,7 +4707,7 @@ enum options_mysqld
OPT_REPLICATE_IGNORE_TABLE, OPT_REPLICATE_WILD_DO_TABLE,
OPT_REPLICATE_WILD_IGNORE_TABLE, OPT_REPLICATE_SAME_SERVER_ID,
OPT_DISCONNECT_SLAVE_EVENT_COUNT, OPT_TC_HEURISTIC_RECOVER,
- OPT_ABORT_SLAVE_EVENT_COUNT, OPT_OLD_LOG_FORMAT, OPT_BOTH_LOG_FORMATS,
+ OPT_ABORT_SLAVE_EVENT_COUNT,
OPT_INNODB_DATA_HOME_DIR,
OPT_INNODB_DATA_FILE_PATH,
OPT_INNODB_LOG_GROUP_HOME_DIR,
@@ -4835,6 +4850,7 @@ enum options_mysqld
OPT_LOG_SLOW_ADMIN_STATEMENTS,
OPT_TABLE_LOCK_WAIT_TIMEOUT,
OPT_PLUGIN_DIR,
+ OPT_LOG_OUTPUT,
OPT_PORT_OPEN_TIMEOUT
};
@@ -5233,6 +5249,13 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
{"log-long-format", '0',
"Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+#ifdef WITH_CSV_STORAGE_ENGINE
+ {"log-output", OPT_LOG_OUTPUT,
+ "Syntax: log-output[=value[,value...]], where \"value\" could be TABLE, "
+ "FILE or NONE.",
+ (gptr*) &log_output_str, (gptr*) &log_output_str, 0,
+ GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+#endif
{"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES,
"Log queries that are executed without benefit of any index to the slow log if it is open.",
(gptr*) &opt_log_queries_not_using_indexes, (gptr*) &opt_log_queries_not_using_indexes,
@@ -5254,16 +5277,6 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
"Log slow queries to this log file. Defaults logging to hostname-slow.log file. Must be enabled to activate other slow log options.",
(gptr*) &opt_slow_logname, (gptr*) &opt_slow_logname, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
-#ifdef WITH_CSV_STORAGE_ENGINE
- {"old-log-format", OPT_OLD_LOG_FORMAT,
- "Enable old log file format. (No SELECT * FROM logs)",
- (gptr*) &opt_old_log_format, 0, 0, GET_BOOL, OPT_ARG,
- 0, 0, 0, 0, 0, 0},
- {"both-log-formats", OPT_BOTH_LOG_FORMATS,
- "Enable old log file format along with log tables",
- (gptr*) &opt_both_log_formats, 0, 0, GET_BOOL, OPT_ARG,
- 0, 0, 0, 0, 0, 0},
-#endif
{"log-tc", OPT_LOG_TC,
"Path to transaction coordinator log (used for transactions that affect "
"more than one storage engine, when binary log is disabled)",
@@ -6957,10 +6970,6 @@ static void mysql_init_variables(void)
opt_skip_slave_start= opt_reckless_slave = 0;
mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0;
opt_log= opt_update_log= opt_slow_log= 0;
-#ifdef WITH_CSV_STORAGE_ENGINE
- opt_old_log_format= 0;
- opt_both_log_formats= 0;
-#endif
opt_bin_log= 0;
opt_disable_networking= opt_skip_show_db=0;
opt_logname= opt_update_logname= opt_binlog_index_name= opt_slow_logname= 0;
@@ -7094,11 +7103,6 @@ static void mysql_init_variables(void)
#else
have_ndbcluster=SHOW_OPTION_NO;
#endif
-#ifdef USE_RAID
- have_raid=SHOW_OPTION_YES;
-#else
- have_raid=SHOW_OPTION_NO;
-#endif
#ifdef HAVE_OPENSSL
have_openssl=SHOW_OPTION_YES;
#else
@@ -7374,12 +7378,25 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_slow_log= 1;
break;
#ifdef WITH_CSV_STORAGE_ENGINE
- case (int) OPT_OLD_LOG_FORMAT:
- opt_old_log_format= 1;
- break;
- case (int) OPT_BOTH_LOG_FORMATS:
- opt_both_log_formats= 1;
+ case OPT_LOG_OUTPUT:
+ {
+ if (!argument || !argument[0])
+ {
+ log_output_options= LOG_TABLE;
+ log_output_str= log_output_typelib.type_names[1];
+ }
+ else
+ {
+ log_output_str= argument;
+ if ((log_output_options=
+ find_bit_type(argument, &log_output_typelib)) == ~(ulong) 0)
+ {
+ fprintf(stderr, "Unknown option to log-output: %s\n", argument);
+ exit(1);
+ }
+ }
break;
+ }
#endif
case (int) OPT_SKIP_NEW:
opt_specialflag|= SPECIAL_NO_NEW_FUNC;
@@ -8133,7 +8150,6 @@ static void create_pid_file()
/*****************************************************************************
Instantiate have_xyx for missing storage engines
*****************************************************************************/
-#undef have_isam
#undef have_berkeley_db
#undef have_innodb
#undef have_ndbcluster
@@ -8146,7 +8162,6 @@ static void create_pid_file()
SHOW_COMP_OPTION have_berkeley_db= SHOW_OPTION_NO;
SHOW_COMP_OPTION have_innodb= SHOW_OPTION_NO;
-SHOW_COMP_OPTION have_isam= SHOW_OPTION_NO;
SHOW_COMP_OPTION have_ndbcluster= SHOW_OPTION_NO;
SHOW_COMP_OPTION have_example_db= SHOW_OPTION_NO;
SHOW_COMP_OPTION have_archive_db= SHOW_OPTION_NO;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 887690aecc1..c0f1abe597c 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -9068,6 +9068,7 @@ void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
quick_prefix_selectivity= (double) quick_prefix_records /
(double) table_records;
num_groups= (uint) rint(num_groups * quick_prefix_selectivity);
+ set_if_bigger(num_groups, 1);
}
if (used_key_parts > group_key_parts)
diff --git a/sql/set_var.cc b/sql/set_var.cc
index a6c2fca7fc5..f082e893205 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -109,7 +109,7 @@ extern ulong ndb_report_thresh_binlog_mem_usage;
-extern volatile my_bool event_executor_running_global_var;
+extern my_bool event_executor_running_global_var;
static HASH system_variable_hash;
const char *bool_type_names[]= { "OFF", "ON", NullS };
@@ -629,14 +629,12 @@ sys_var_have_variable sys_have_federated_db("have_federated_engine",
&have_federated_db);
sys_var_have_variable sys_have_geometry("have_geometry", &have_geometry);
sys_var_have_variable sys_have_innodb("have_innodb", &have_innodb);
-sys_var_have_variable sys_have_isam("have_isam", &have_isam);
sys_var_have_variable sys_have_ndbcluster("have_ndbcluster", &have_ndbcluster);
sys_var_have_variable sys_have_openssl("have_openssl", &have_openssl);
sys_var_have_variable sys_have_partition_db("have_partitioning",
&have_partition_db);
sys_var_have_variable sys_have_query_cache("have_query_cache",
&have_query_cache);
-sys_var_have_variable sys_have_raid("have_raid", &have_raid);
sys_var_have_variable sys_have_rtree_keys("have_rtree_keys", &have_rtree_keys);
sys_var_have_variable sys_have_symlink("have_symlink", &have_symlink);
sys_var_have_variable sys_have_row_based_replication("have_row_based_replication",&have_row_based_replication);
@@ -750,12 +748,10 @@ SHOW_VAR init_vars[]= {
{sys_have_federated_db.name,(char*) &have_federated_db, SHOW_HAVE},
{sys_have_geometry.name, (char*) &have_geometry, SHOW_HAVE},
{sys_have_innodb.name, (char*) &have_innodb, SHOW_HAVE},
- {sys_have_isam.name, (char*) &have_isam, SHOW_HAVE},
{sys_have_ndbcluster.name, (char*) &have_ndbcluster, SHOW_HAVE},
{sys_have_openssl.name, (char*) &have_openssl, SHOW_HAVE},
{sys_have_partition_db.name,(char*) &have_partition_db, SHOW_HAVE},
{sys_have_query_cache.name, (char*) &have_query_cache, SHOW_HAVE},
- {sys_have_raid.name, (char*) &have_raid, SHOW_HAVE},
{sys_have_row_based_replication.name, (char*) &have_row_based_replication, SHOW_HAVE},
{sys_have_rtree_keys.name, (char*) &have_rtree_keys, SHOW_HAVE},
{sys_have_symlink.name, (char*) &have_symlink, SHOW_HAVE},
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index 346393041e9..ba2e2e0ce72 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -1479,30 +1479,30 @@ ER_DUP_KEYNAME 42000 S1009
swe "Nyckelnamn '%-.64s' finns flera gnger"
ukr " ' '%-.64s'"
ER_DUP_ENTRY 23000 S1009
- cze "Zvojen-B kl '%-.64s' (slo kle %d)"
- dan "Ens vrdier '%-.64s' for indeks %d"
- nla "Dubbele ingang '%-.64s' voor zoeksleutel %d"
- eng "Duplicate entry '%-.64s' for key %d"
- jps "'%-.64s' key %d ɂďdĂ܂",
- est "Kattuv vrtus '%-.64s' vtmele %d"
- fre "Duplicata du champ '%-.64s' pour la clef %d"
- ger "Doppelter Eintrag '%-.64s' fr Schlssel %d"
- greek " '%-.64s' %d"
- hun "Duplikalt bejegyzes '%-.64s' a %d kulcs szerint."
- ita "Valore duplicato '%-.64s' per la chiave %d"
- jpn "'%-.64s' key %d ˤƽʣƤޤ"
- kor "ߺ Է '%-.64s': key %d"
- nor "Like verdier '%-.64s' for nkkel %d"
- norwegian-ny "Like verdiar '%-.64s' for nykkel %d"
- pol "Powtrzone wyst?pienie '%-.64s' dla klucza %d"
- por "Entrada '%-.64s' duplicada para a chave %d"
- rum "Cimpul '%-.64s' e duplicat pentru cheia %d"
- rus " '%-.64s' %d"
- serbian "Dupliran unos '%-.64s' za klju '%d'"
- slo "Opakovan k '%-.64s' (slo ka %d)"
- spa "Entrada duplicada '%-.64s' para la clave %d"
- swe "Dubbel nyckel '%-.64s' fr nyckel %d"
- ukr " '%-.64s' %d"
+ cze "Zvojen-B kl '%-.64s' (slo kle '%-.64s')"
+ dan "Ens vrdier '%-.64s' for indeks '%-.64s'"
+ nla "Dubbele ingang '%-.64s' voor zoeksleutel '%-.64s'"
+ eng "Duplicate entry '%-.64s' for key '%-.64s'"
+ jps "'%-.64s' key '%-.64s' ɂďdĂ܂",
+ est "Kattuv vrtus '%-.64s' vtmele '%-.64s'"
+ fre "Duplicata du champ '%-.64s' pour la clef '%-.64s'"
+ ger "Doppelter Eintrag '%-.64s' fr Schlssel '%-.64s'"
+ greek " '%-.64s' '%-.64s'"
+ hun "Duplikalt bejegyzes '%-.64s' a '%-.64s' kulcs szerint."
+ ita "Valore duplicato '%-.64s' per la chiave '%-.64s'"
+ jpn "'%-.64s' key '%-.64s' ˤƽʣƤޤ"
+ kor "ߺ Է '%-.64s': key '%-.64s'"
+ nor "Like verdier '%-.64s' for nkkel '%-.64s'"
+ norwegian-ny "Like verdiar '%-.64s' for nykkel '%-.64s'"
+ pol "Powtrzone wyst?pienie '%-.64s' dla klucza '%-.64s'"
+ por "Entrada '%-.64s' duplicada para a chave '%-.64s'"
+ rum "Cimpul '%-.64s' e duplicat pentru cheia '%-.64s'"
+ rus " '%-.64s' '%-.64s'"
+ serbian "Dupliran unos '%-.64s' za klju '%-.64s'"
+ slo "Opakovan k '%-.64s' (slo ka '%-.64s')"
+ spa "Entrada duplicada '%-.64s' para la clave '%-.64s'"
+ swe "Dubbel nyckel '%-.64s' fr nyckel '%-.64s'"
+ ukr " '%-.64s' '%-.64s'"
ER_WRONG_FIELD_SPEC 42000 S1009
cze "Chybn-B specifikace sloupce '%-.64s'"
dan "Forkert kolonnespecifikaton for felt '%-.64s'"
@@ -5800,3 +5800,5 @@ ER_CANT_READ_LOCK_LOG_TABLE
eng "You can't use usual read lock with log tables. Try READ LOCAL instead."
ER_SP_WRONG_NAME 42000
eng "Incorrect routine name '%-.64s'"
+ER_FOREIGN_DUPLICATE_KEY 23000 S1009
+ eng "Upholding foreign key constraints for table '%.64s', entry '%-.64s', key %d would lead to a duplicate entry"
diff --git a/sql/sp.cc b/sql/sp.cc
index bf639b13a41..4838f839b4e 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -1003,22 +1003,26 @@ sp_find_routine(THD *thd, int type, sp_name *name, sp_cache **cp,
}
+/*
+ This is used by sql_acl.cc:mysql_routine_grant() and is used to find
+ the routines in 'routines'.
+*/
int
-sp_exists_routine(THD *thd, TABLE_LIST *tables, bool any, bool no_error)
+sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any, bool no_error)
{
- TABLE_LIST *table;
+ TABLE_LIST *routine;
bool result= 0;
DBUG_ENTER("sp_exists_routine");
- for (table= tables; table; table= table->next_global)
+ for (routine= routines; routine; routine= routine->next_global)
{
sp_name *name;
LEX_STRING lex_db;
LEX_STRING lex_name;
- lex_db.length= strlen(table->db);
- lex_name.length= strlen(table->table_name);
- lex_db.str= thd->strmake(table->db, lex_db.length);
- lex_name.str= thd->strmake(table->table_name, lex_name.length);
+ lex_db.length= strlen(routine->db);
+ lex_name.length= strlen(routine->table_name);
+ lex_db.str= thd->strmake(routine->db, lex_db.length);
+ lex_name.str= thd->strmake(routine->table_name, lex_name.length);
name= new sp_name(lex_db, lex_name);
name->init_qname(thd);
if (sp_find_routine(thd, TYPE_ENUM_PROCEDURE, name,
@@ -1035,7 +1039,7 @@ sp_exists_routine(THD *thd, TABLE_LIST *tables, bool any, bool no_error)
if (!no_error)
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION or PROCEDURE",
- table->table_name);
+ routine->table_name);
DBUG_RETURN(-1);
}
DBUG_RETURN(0);
@@ -1045,6 +1049,39 @@ sp_exists_routine(THD *thd, TABLE_LIST *tables, bool any, bool no_error)
}
+/*
+ Check if a routine exists in the mysql.proc table, without actually
+ parsing the definition. (Used for dropping)
+
+ SYNOPSIS
+ sp_routine_exists_in_table()
+ thd - thread context
+ name - name of procedure
+
+ RETURN VALUE
+ 0 - Success
+ non-0 - Error; SP_OPEN_TABLE_FAILED or SP_KEY_NOT_FOUND
+*/
+
+int
+sp_routine_exists_in_table(THD *thd, int type, sp_name *name)
+{
+ TABLE *table;
+ int ret;
+ Open_tables_state open_tables_state_backup;
+
+ if (!(table= open_proc_table_for_read(thd, &open_tables_state_backup)))
+ ret= SP_OPEN_TABLE_FAILED;
+ else
+ {
+ if ((ret= db_find_routine_aux(thd, type, name, table)) != SP_OK)
+ ret= SP_KEY_NOT_FOUND;
+ close_proc_table(thd, &open_tables_state_backup);
+ }
+ return ret;
+}
+
+
int
sp_create_procedure(THD *thd, sp_head *sp)
{
diff --git a/sql/sp.h b/sql/sp.h
index 53343e0fb25..2587a9b115a 100644
--- a/sql/sp.h
+++ b/sql/sp.h
@@ -40,7 +40,10 @@ sp_find_routine(THD *thd, int type, sp_name *name,
sp_cache **cp, bool cache_only);
int
-sp_exists_routine(THD *thd, TABLE_LIST *procs, bool any, bool no_error);
+sp_exist_routines(THD *thd, TABLE_LIST *procs, bool any, bool no_error);
+
+int
+sp_routine_exists_in_table(THD *thd, int type, sp_name *name);
int
sp_create_procedure(THD *thd, sp_head *sp);
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 62de35cc109..cf1097a28c6 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1776,7 +1776,7 @@ sp_head::fill_field_definition(THD *thd, LEX *lex,
void
-sp_head::new_cont_backpatch(sp_instr_jump_if_not *i)
+sp_head::new_cont_backpatch(sp_instr_opt_meta *i)
{
m_cont_level+= 1;
if (i)
@@ -1788,7 +1788,7 @@ sp_head::new_cont_backpatch(sp_instr_jump_if_not *i)
}
void
-sp_head::add_cont_backpatch(sp_instr_jump_if_not *i)
+sp_head::add_cont_backpatch(sp_instr_opt_meta *i)
{
i->m_cont_dest= m_cont_level;
(void)m_cont_backpatch.push_front(i);
@@ -1799,7 +1799,7 @@ sp_head::do_cont_backpatch()
{
uint dest= instructions();
uint lev= m_cont_level--;
- sp_instr_jump_if_not *i;
+ sp_instr_opt_meta *i;
while ((i= m_cont_backpatch.head()) && i->m_cont_dest == lev)
{
@@ -2063,10 +2063,10 @@ void sp_head::optimize()
set_dynamic(&m_instr, (gptr)&i, dst);
while ((ibp= li++))
- {
- sp_instr_jump *ji= static_cast(ibp);
- ji->set_destination(src, dst);
- }
+ {
+ sp_instr_opt_meta *im= static_cast(ibp);
+ im->set_destination(src, dst);
+ }
}
i->opt_move(dst, &bp);
src+= 1;
@@ -2088,6 +2088,10 @@ sp_head::opt_mark(uint ip)
#ifndef DBUG_OFF
+/*
+ Return the routine instructions as a result set.
+ Returns 0 if ok, !=0 on error.
+*/
int
sp_head::show_routine_code(THD *thd)
{
@@ -2115,6 +2119,22 @@ sp_head::show_routine_code(THD *thd)
for (ip= 0; (i = get_instr(ip)) ; ip++)
{
+ /*
+ Consistency check. If these are different something went wrong
+ during optimization.
+ */
+ if (ip != i->m_ip)
+ {
+ const char *format= "Instruction at position %u has m_ip=%u";
+ char tmp[sizeof(format) + 2*SP_INSTR_UINT_MAXLEN + 1];
+
+ sprintf(tmp, format, ip, i->m_ip);
+ /*
+ Since this is for debugging purposes only, we don't bother to
+ introduce a special error code for it.
+ */
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, tmp);
+ }
protocol->prepare_for_resend();
protocol->store((longlong)ip);
@@ -2539,14 +2559,14 @@ sp_instr_jump_if_not::exec_core(THD *thd, uint *nextp)
void
sp_instr_jump_if_not::print(String *str)
{
- /* jump_if_not dest ... */
+ /* jump_if_not dest(cont) ... */
if (str->reserve(2*SP_INSTR_UINT_MAXLEN+14+32)) // Add some for the expr. too
return;
str->qs_append(STRING_WITH_LEN("jump_if_not "));
str->qs_append(m_dest);
- str->append('(');
+ str->qs_append('(');
str->qs_append(m_cont_dest);
- str->append(") ");
+ str->qs_append(STRING_WITH_LEN(") "));
m_expr->print(str);
}
@@ -3092,30 +3112,53 @@ sp_instr_set_case_expr::exec_core(THD *thd, uint *nextp)
spcont->clear_handler();
thd->spcont= spcont;
}
+ *nextp= m_cont_dest; /* For continue handler */
}
+ else
+ *nextp= m_ip+1;
- *nextp = m_ip+1;
-
- return res; /* no error */
+ return res;
}
void
sp_instr_set_case_expr::print(String *str)
{
- const char CASE_EXPR_TAG[]= "set_case_expr ";
- const int CASE_EXPR_TAG_LEN= sizeof(CASE_EXPR_TAG) - 1;
- const int INT_STRING_MAX_LEN= 10;
-
- /* We must call reserve(), because qs_append() doesn't care about memory. */
- str->reserve(CASE_EXPR_TAG_LEN + INT_STRING_MAX_LEN + 2);
-
- str->qs_append(CASE_EXPR_TAG, CASE_EXPR_TAG_LEN);
+ /* set_case_expr (cont) id ... */
+ str->reserve(2*SP_INSTR_UINT_MAXLEN+18+32); // Add some extra for expr too
+ str->qs_append(STRING_WITH_LEN("set_case_expr ("));
+ str->qs_append(m_cont_dest);
+ str->qs_append(STRING_WITH_LEN(") "));
str->qs_append(m_case_expr_id);
str->qs_append(' ');
m_case_expr->print(str);
}
+uint
+sp_instr_set_case_expr::opt_mark(sp_head *sp)
+{
+ sp_instr *i;
+
+ marked= 1;
+ if ((i= sp->get_instr(m_cont_dest)))
+ {
+ m_cont_dest= i->opt_shortcut_jump(sp, this);
+ m_cont_optdest= sp->get_instr(m_cont_dest);
+ }
+ sp->opt_mark(m_cont_dest);
+ return m_ip+1;
+}
+
+void
+sp_instr_set_case_expr::opt_move(uint dst, List *bp)
+{
+ if (m_cont_dest > m_ip)
+ bp->push_back(this); // Forward
+ else if (m_cont_optdest)
+ m_cont_dest= m_cont_optdest->m_ip; // Backward
+ m_ip= dst;
+}
+
/* ------------------------------------------------------------------ */
diff --git a/sql/sp_head.h b/sql/sp_head.h
index f9c37090322..a637c466041 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -41,6 +41,7 @@ sp_get_flags_for_command(LEX *lex);
struct sp_label;
class sp_instr;
+class sp_instr_opt_meta;
class sp_instr_jump_if_not;
struct sp_cond_type;
struct sp_pvar;
@@ -270,11 +271,11 @@ public:
// Start a new cont. backpatch level. If 'i' is NULL, the level is just incr.
void
- new_cont_backpatch(sp_instr_jump_if_not *i);
+ new_cont_backpatch(sp_instr_opt_meta *i);
// Add an instruction to the current level
void
- add_cont_backpatch(sp_instr_jump_if_not *i);
+ add_cont_backpatch(sp_instr_opt_meta *i);
// Backpatch (and pop) the current level to the current position.
void
@@ -371,15 +372,15 @@ private:
} bp_t;
List m_backpatch; // Instructions needing backpatching
/*
- We need a special list for backpatching of conditional jump's continue
+ We need a special list for backpatching of instructions with a continue
destination (in the case of a continue handler catching an error in
the test), since it would otherwise interfere with the normal backpatch
- mechanism - jump_if_not instructions have two different destination
+ mechanism - e.g. jump_if_not instructions have two different destinations
which are to be patched differently.
Since these occur in a more restricted way (always the same "level" in
the code), we don't need the label.
*/
- List m_cont_backpatch;
+ List m_cont_backpatch;
uint m_cont_level; // The current cont. backpatch level
/*
@@ -676,21 +677,55 @@ private:
}; // class sp_instr_trigger_field : public sp_instr
-class sp_instr_jump : public sp_instr
+/*
+ An abstract class for all instructions with destinations that
+ needs to be updated by the optimizer.
+ Even if not all subclasses will use both the normal destination and
+ the continuation destination, we put them both here for simplicity.
+ */
+class sp_instr_opt_meta : public sp_instr
+{
+public:
+
+ uint m_dest; // Where we will go
+ uint m_cont_dest; // Where continue handlers will go
+
+ sp_instr_opt_meta(uint ip, sp_pcontext *ctx)
+ : sp_instr(ip, ctx),
+ m_dest(0), m_cont_dest(0), m_optdest(0), m_cont_optdest(0)
+ {}
+
+ sp_instr_opt_meta(uint ip, sp_pcontext *ctx, uint dest)
+ : sp_instr(ip, ctx),
+ m_dest(dest), m_cont_dest(0), m_optdest(0), m_cont_optdest(0)
+ {}
+
+ virtual ~sp_instr_opt_meta()
+ {}
+
+ virtual void set_destination(uint old_dest, uint new_dest)
+ = 0;
+
+protected:
+
+ sp_instr *m_optdest; // Used during optimization
+ sp_instr *m_cont_optdest; // Used during optimization
+
+}; // class sp_instr_opt_meta : public sp_instr
+
+class sp_instr_jump : public sp_instr_opt_meta
{
sp_instr_jump(const sp_instr_jump &); /* Prevent use of these */
void operator=(sp_instr_jump &);
public:
- uint m_dest; // Where we will go
-
sp_instr_jump(uint ip, sp_pcontext *ctx)
- : sp_instr(ip, ctx), m_dest(0), m_optdest(0)
+ : sp_instr_opt_meta(ip, ctx)
{}
sp_instr_jump(uint ip, sp_pcontext *ctx, uint dest)
- : sp_instr(ip, ctx), m_dest(dest), m_optdest(0)
+ : sp_instr_opt_meta(ip, ctx, dest)
{}
virtual ~sp_instr_jump()
@@ -721,11 +756,7 @@ public:
m_dest= new_dest;
}
-protected:
-
- sp_instr *m_optdest; // Used during optimization
-
-}; // class sp_instr_jump : public sp_instr
+}; // class sp_instr_jump : public sp_instr_opt_meta
class sp_instr_jump_if_not : public sp_instr_jump
@@ -735,16 +766,14 @@ class sp_instr_jump_if_not : public sp_instr_jump
public:
- uint m_cont_dest; // Where continue handlers will go
-
sp_instr_jump_if_not(uint ip, sp_pcontext *ctx, Item *i, LEX *lex)
- : sp_instr_jump(ip, ctx), m_cont_dest(0), m_expr(i),
- m_lex_keeper(lex, TRUE), m_cont_optdest(0)
+ : sp_instr_jump(ip, ctx), m_expr(i),
+ m_lex_keeper(lex, TRUE)
{}
sp_instr_jump_if_not(uint ip, sp_pcontext *ctx, Item *i, uint dest, LEX *lex)
- : sp_instr_jump(ip, ctx, dest), m_cont_dest(0), m_expr(i),
- m_lex_keeper(lex, TRUE), m_cont_optdest(0)
+ : sp_instr_jump(ip, ctx, dest), m_expr(i),
+ m_lex_keeper(lex, TRUE)
{}
virtual ~sp_instr_jump_if_not()
@@ -777,7 +806,6 @@ private:
Item *m_expr; // The condition
sp_lex_keeper m_lex_keeper;
- sp_instr *m_cont_optdest; // Used during optimization
}; // class sp_instr_jump_if_not : public sp_instr_jump
@@ -911,7 +939,7 @@ private:
uint m_frame;
-}; // class sp_instr_hreturn : public sp_instr
+}; // class sp_instr_hreturn : public sp_instr_jump
/* This is DECLARE CURSOR */
@@ -1088,14 +1116,18 @@ private:
}; // class sp_instr_error : public sp_instr
-class sp_instr_set_case_expr :public sp_instr
+class sp_instr_set_case_expr : public sp_instr_opt_meta
{
public:
sp_instr_set_case_expr(uint ip, sp_pcontext *ctx, uint case_expr_id,
Item *case_expr, LEX *lex)
- :sp_instr(ip, ctx), m_case_expr_id(case_expr_id), m_case_expr(case_expr),
- m_lex_keeper(lex, TRUE)
+ : sp_instr_opt_meta(ip, ctx),
+ m_case_expr_id(case_expr_id), m_case_expr(case_expr),
+ m_lex_keeper(lex, TRUE)
+ {}
+
+ virtual ~sp_instr_set_case_expr()
{}
virtual int execute(THD *thd, uint *nextp);
@@ -1104,13 +1136,23 @@ public:
virtual void print(String *str);
+ virtual uint opt_mark(sp_head *sp);
+
+ virtual void opt_move(uint dst, List *ibp);
+
+ virtual void set_destination(uint old_dest, uint new_dest)
+ {
+ if (m_cont_dest == old_dest)
+ m_cont_dest= new_dest;
+ }
+
private:
uint m_case_expr_id;
Item *m_case_expr;
sp_lex_keeper m_lex_keeper;
-}; // class sp_instr_set_case_expr : public sp_instr
+}; // class sp_instr_set_case_expr : public sp_instr_opt_meta
#ifndef NO_EMBEDDED_ACCESS_CHECKS
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index cfcdd6d9e61..49f05a29ef3 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -3045,7 +3045,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
if (!revoke_grant)
{
- if (sp_exists_routine(thd, table_list, is_proc, no_error)<0)
+ if (sp_exist_routines(thd, table_list, is_proc, no_error)<0)
DBUG_RETURN(TRUE);
}
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 44b3a22ec52..a825b307ee3 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -3858,13 +3858,37 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
register_tree_change, actual_table);
}
+ if (fld)
+ {
#ifndef NO_EMBEDDED_ACCESS_CHECKS
- /* Check if there are sufficient access rights to the found field. */
- if (fld && check_privileges &&
- check_column_grant_in_table_ref(thd, *actual_table, name, length))
- fld= WRONG_GRANT;
+ /* Check if there are sufficient access rights to the found field. */
+ if (check_privileges &&
+ check_column_grant_in_table_ref(thd, *actual_table, name, length))
+ fld= WRONG_GRANT;
+ else
#endif
-
+ if (thd->set_query_id)
+ {
+ /*
+ * get rw_set correct for this field so that the handler
+ * knows that this field is involved in the query and gets
+ * retrieved/updated
+ */
+ Field *field_to_set= NULL;
+ if (fld == view_ref_found)
+ {
+ Item *it= (*ref)->real_item();
+ if (it->type() == Item::FIELD_ITEM)
+ field_to_set= ((Item_field*)it)->field;
+ }
+ else
+ field_to_set= fld;
+ if (field_to_set)
+ field_to_set->table->file->
+ ha_set_bit_in_rw_set(field_to_set->fieldnr,
+ (bool)(thd->set_query_id-1));
+ }
+ }
DBUG_RETURN(fld);
}
@@ -5044,6 +5068,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
DBUG_ENTER("setup_fields");
thd->set_query_id=set_query_id;
+ DBUG_PRINT("info", ("thd->set_query_id: %d", thd->set_query_id));
if (allow_sum_func)
thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level;
thd->where= THD::DEFAULT_WHERE;
@@ -5070,6 +5095,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
{
thd->lex->allow_sum_func= save_allow_sum_func;
thd->set_query_id= save_set_query_id;
+ DBUG_PRINT("info", ("thd->set_query_id: %d", thd->set_query_id));
DBUG_RETURN(TRUE); /* purecov: inspected */
}
if (ref)
@@ -5081,6 +5107,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
}
thd->lex->allow_sum_func= save_allow_sum_func;
thd->set_query_id= save_set_query_id;
+ DBUG_PRINT("info", ("thd->set_query_id: %d", thd->set_query_id));
DBUG_RETURN(test(thd->net.report_error));
}
@@ -5527,6 +5554,7 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
arena= 0; // For easier test
thd->set_query_id=1;
+ DBUG_PRINT("info", ("thd->set_query_id: %d", thd->set_query_id));
select_lex->cond_count= 0;
for (table= tables; table; table= table->next_local)
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index a9050ddf277..20c71ae738b 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1128,7 +1128,7 @@ void st_select_lex::init_query()
embedding= leaf_tables= 0;
item_list.empty();
join= 0;
- having= where= prep_where= 0;
+ having= prep_having= where= prep_where= 0;
olap= UNSPECIFIED_OLAP_TYPE;
having_fix_field= 0;
context.select_lex= this;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 07a42f7af2c..6b83525ba18 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -493,6 +493,7 @@ public:
char *db;
Item *where, *having; /* WHERE & HAVING clauses */
Item *prep_where; /* saved WHERE clause for prepared statement processing */
+ Item *prep_having;/* saved HAVING clause for prepared statement processing */
/* point on lex in which it was created, used in view subquery detection */
st_lex *parent_lex;
enum olap_type olap;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 279a02fa1d1..5d18fe2d627 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3743,6 +3743,8 @@ end_with_restore_list:
res= evex_drop_event(thd, lex->et, lex->drop_if_exists, &rows_affected);
default:;
}
+ DBUG_PRINT("info", ("CREATE/ALTER/DROP returned error code=%d af_rows=%d",
+ res, rows_affected));
if (!res)
send_ok(thd, rows_affected);
@@ -4490,21 +4492,17 @@ end_with_restore_list:
case SQLCOM_DROP_PROCEDURE:
case SQLCOM_DROP_FUNCTION:
{
- sp_head *sp;
int result;
- char *db, *name;
+ int type= (lex->sql_command == SQLCOM_DROP_PROCEDURE ?
+ TYPE_ENUM_PROCEDURE : TYPE_ENUM_FUNCTION);
- if (lex->sql_command == SQLCOM_DROP_PROCEDURE)
- sp= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, lex->spname,
- &thd->sp_proc_cache, FALSE);
- else
- sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, lex->spname,
- &thd->sp_func_cache, FALSE);
+ result= sp_routine_exists_in_table(thd, type, lex->spname);
mysql_reset_errors(thd, 0);
- if (sp)
+ if (result == SP_OK)
{
- db= thd->strdup(sp->m_db.str);
- name= thd->strdup(sp->m_name.str);
+ char *db= lex->spname->m_db.str;
+ char *name= lex->spname->m_name.str;
+
if (check_routine_access(thd, ALTER_PROC_ACL, db, name,
lex->sql_command == SQLCOM_DROP_PROCEDURE, 0))
goto error;
@@ -4644,7 +4642,7 @@ end_with_restore_list:
else
sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, lex->spname,
&thd->sp_func_cache, FALSE);
- if (!sp || !sp->show_routine_code(thd))
+ if (!sp || sp->show_routine_code(thd))
{
/* We don't distinguish between errors for now */
my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 3d138b4e3d0..290d512198f 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -1984,6 +1984,7 @@ bool fix_partition_func(THD *thd, const char* name, TABLE *table,
DBUG_RETURN(FALSE);
}
thd->set_query_id= 0;
+ DBUG_PRINT("info", ("thd->set_query_id: %d", thd->set_query_id));
/*
Set-up the TABLE_LIST object to be a list with a single table
Set the object to zero to create NULL pointers and set alias
@@ -2120,6 +2121,7 @@ bool fix_partition_func(THD *thd, const char* name, TABLE *table,
result= FALSE;
end:
thd->set_query_id= save_set_query_id;
+ DBUG_PRINT("info", ("thd->set_query_id: %d", thd->set_query_id));
DBUG_RETURN(result);
}
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index b8628b18dd4..9f17694a137 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -345,7 +345,7 @@ struct st_plugin_int *plugin_lock(LEX_STRING *name, int type)
rw_wrlock(&THR_LOCK_plugin);
if ((rc= plugin_find_internal(name, type)))
{
- if (rc->state == PLUGIN_IS_READY)
+ if (rc->state == PLUGIN_IS_READY || rc->state == PLUGIN_IS_UNINITIALIZED)
rc->ref_count++;
else
rc= 0;
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index cb080ba68e0..1b9cca9d84f 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -411,7 +411,7 @@ static void set_param_decimal(Item_param *param, uchar **pos, ulong len)
{
ulong length= get_param_length(pos, len);
param->set_decimal((char*)*pos, length);
- *pos+= len;
+ *pos+= length;
}
#ifndef EMBEDDED_LIBRARY
@@ -2075,14 +2075,19 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
sl->exclude_from_table_unique_test= FALSE;
/*
- Copy WHERE clause pointers to avoid damaging they by optimisation
+ Copy WHERE, HAVING clause pointers to avoid damaging them by optimisation
*/
- if (sl->prep_where)
- {
- sl->where= sl->prep_where->copy_andor_structure(thd);
- sl->where->cleanup();
- }
- DBUG_ASSERT(sl->join == 0);
+ if (sl->prep_where)
+ {
+ sl->where= sl->prep_where->copy_andor_structure(thd);
+ sl->where->cleanup();
+ }
+ if (sl->prep_having)
+ {
+ sl->having= sl->prep_having->copy_andor_structure(thd);
+ sl->having->cleanup();
+ }
+ DBUG_ASSERT(sl->join == 0);
ORDER *order;
/* Fix GROUP list */
for (order= (ORDER *)sl->group_list.first; order; order= order->next)
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c5aca91c9e9..cafcd94632a 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -612,6 +612,7 @@ JOIN::optimize()
build_bitmap_for_nested_joins(join_list, 0);
sel->prep_where= conds ? conds->copy_andor_structure(thd) : 0;
+ sel->prep_having= having ? having->copy_andor_structure(thd) : 0;
if (arena)
thd->restore_active_arena(arena, &backup);
@@ -625,13 +626,26 @@ JOIN::optimize()
DBUG_RETURN(1);
}
- if (cond_value == Item::COND_FALSE ||
- (!unit->select_limit_cnt && !(select_options & OPTION_FOUND_ROWS)))
- { /* Impossible cond */
- DBUG_PRINT("info", ("Impossible WHERE"));
- zero_result_cause= "Impossible WHERE";
- error= 0;
- DBUG_RETURN(0);
+ {
+ Item::cond_result having_value;
+ having= optimize_cond(this, having, join_list, &having_value);
+ if (thd->net.report_error)
+ {
+ error= 1;
+ DBUG_PRINT("error",("Error from optimize_cond"));
+ DBUG_RETURN(1);
+ }
+
+ if (cond_value == Item::COND_FALSE || having_value == Item::COND_FALSE ||
+ (!unit->select_limit_cnt && !(select_options & OPTION_FOUND_ROWS)))
+ { /* Impossible cond */
+ DBUG_PRINT("info", (having_value == Item::COND_FALSE ?
+ "Impossible HAVING" : "Impossible WHERE"));
+ zero_result_cause= having_value == Item::COND_FALSE ?
+ "Impossible HAVING" : "Impossible WHERE";
+ error= 0;
+ DBUG_RETURN(0);
+ }
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -12472,7 +12486,8 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
overshadows the column reference from the SELECT list.
*/
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_NON_UNIQ_ERROR,
- ER(ER_NON_UNIQ_ERROR), from_field->field_name,
+ ER(ER_NON_UNIQ_ERROR),
+ ((Item_ident*) order_item)->field_name,
current_thd->where);
}
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 2289ad219a2..d31d686e38d 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1234,15 +1234,6 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
packet->append(STRING_WITH_LEN(" CONNECTION="));
append_unescaped(packet, share->connect_string.str, share->connect_string.length);
}
- if (file->raid_type)
- {
- uint length;
- length= my_snprintf(buff,sizeof(buff),
- " RAID_TYPE=%s RAID_CHUNKS=%d RAID_CHUNKSIZE=%ld",
- my_raid_type(file->raid_type), file->raid_chunks,
- file->raid_chunksize/RAID_BLOCK_SIZE);
- packet->append(buff, length);
- }
append_directory(thd, packet, "DATA", create_info.data_file_name);
append_directory(thd, packet, "INDEX", create_info.index_file_name);
}
@@ -2591,15 +2582,6 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables,
ptr=strxmov(ptr, " row_format=",
ha_row_type[(uint) share->row_type],
NullS);
- if (file->raid_type)
- {
- char buff[100];
- my_snprintf(buff,sizeof(buff),
- " raid_type=%s raid_chunks=%d raid_chunksize=%ld",
- my_raid_type(file->raid_type), file->raid_chunks,
- file->raid_chunksize/RAID_BLOCK_SIZE);
- ptr=strmov(ptr,buff);
- }
table->field[19]->store(option_buff+1,
(ptr == option_buff ? 0 :
(uint) (ptr-option_buff)-1), cs);
@@ -4005,7 +3987,7 @@ int fill_schema_events(THD *thd, TABLE_LIST *tables, COND *cond)
store(thd->lex->select_lex.db, strlen(thd->lex->select_lex.db), scs);
key_len+= event_table->key_info->key_part[1].store_length;
}
- if (!(key_buf= alloc_root(thd->mem_root, key_len)))
+ if (!(key_buf= (byte *)alloc_root(thd->mem_root, key_len)))
{
ret= 1;
goto err;
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 78497a2cf8b..c4cb9770e14 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -1338,6 +1338,7 @@ bool check_key_in_view(THD *thd, TABLE_LIST *view)
*/
bool save_set_query_id= thd->set_query_id;
thd->set_query_id= 0;
+ DBUG_PRINT("info", ("thd->set_query_id: %d", thd->set_query_id));
for (Field_translator *fld= trans; fld < end_of_trans; fld++)
{
if (!fld->item->fixed && fld->item->fix_fields(thd, &fld->item))
@@ -1347,6 +1348,7 @@ bool check_key_in_view(THD *thd, TABLE_LIST *view)
}
}
thd->set_query_id= save_set_query_id;
+ DBUG_PRINT("info", ("thd->set_query_id: %d", thd->set_query_id));
}
/* Loop over all keys to see if a unique-not-null key is used */
for (;key_info != key_info_end ; key_info++)
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 79651f2e49e..f4851a3dc2d 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -516,11 +516,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token QUARTER_SYM
%token QUERY_SYM
%token QUICK
-%token RAID_0_SYM
-%token RAID_CHUNKS
-%token RAID_CHUNKSIZE
-%token RAID_STRIPED_SYM
-%token RAID_TYPE
%token RAND
%token RANGE_SYM
%token READS_SYM
@@ -753,7 +748,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
union_opt select_derived_init option_type2
%type
- ulong_num raid_types merge_insert_types
+ ulong_num merge_insert_types
%type
ulonglong_num size_number
@@ -2400,17 +2395,18 @@ sp_proc_stmt_case:
sp_head *sp= lex->sphead;
sp_pcontext *parsing_ctx= lex->spcont;
int case_expr_id= parsing_ctx->register_case_expr();
+ sp_instr_set_case_expr *i;
if (parsing_ctx->push_case_expr_id(case_expr_id))
YYABORT;
-
- sp->add_instr(
- new sp_instr_set_case_expr(sp->instructions(),
- parsing_ctx,
- case_expr_id,
- $3,
- lex));
-
+
+ i= new sp_instr_set_case_expr(sp->instructions(),
+ parsing_ctx,
+ case_expr_id,
+ $3,
+ lex);
+ sp->add_cont_backpatch(i);
+ sp->add_instr(i);
sp->m_flags|= sp_head::IN_SIMPLE_CASE;
sp->restore_lex(YYTHD);
}
@@ -3995,7 +3991,6 @@ create_table_options:
create_table_option:
ENGINE_SYM opt_equal storage_engines { Lex->create_info.db_type= $3; Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE; }
- | TYPE_SYM opt_equal storage_engines { Lex->create_info.db_type= $3; WARN_DEPRECATED("TYPE=storage_engine","ENGINE=storage_engine"); Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE; }
| MAX_ROWS opt_equal ulonglong_num { Lex->create_info.max_rows= $3; Lex->create_info.used_fields|= HA_CREATE_USED_MAX_ROWS;}
| MIN_ROWS opt_equal ulonglong_num { Lex->create_info.min_rows= $3; Lex->create_info.used_fields|= HA_CREATE_USED_MIN_ROWS;}
| AVG_ROW_LENGTH opt_equal ulong_num { Lex->create_info.avg_row_length=$3; Lex->create_info.used_fields|= HA_CREATE_USED_AVG_ROW_LENGTH;}
@@ -4026,21 +4021,6 @@ create_table_option:
| CHECKSUM_SYM opt_equal ulong_num { Lex->create_info.table_options|= $3 ? HA_OPTION_CHECKSUM : HA_OPTION_NO_CHECKSUM; Lex->create_info.used_fields|= HA_CREATE_USED_CHECKSUM; }
| DELAY_KEY_WRITE_SYM opt_equal ulong_num { Lex->create_info.table_options|= $3 ? HA_OPTION_DELAY_KEY_WRITE : HA_OPTION_NO_DELAY_KEY_WRITE; Lex->create_info.used_fields|= HA_CREATE_USED_DELAY_KEY_WRITE; }
| ROW_FORMAT_SYM opt_equal row_types { Lex->create_info.row_type= $3; Lex->create_info.used_fields|= HA_CREATE_USED_ROW_FORMAT; }
- | RAID_TYPE opt_equal raid_types
- {
- my_error(ER_WARN_DEPRECATED_SYNTAX, MYF(0), "RAID_TYPE", "PARTITION");
- YYABORT;
- }
- | RAID_CHUNKS opt_equal ulong_num
- {
- my_error(ER_WARN_DEPRECATED_SYNTAX, MYF(0), "RAID_CHUNKS", "PARTITION");
- YYABORT;
- }
- | RAID_CHUNKSIZE opt_equal ulong_num
- {
- my_error(ER_WARN_DEPRECATED_SYNTAX, MYF(0), "RAID_CHUNKSIZE", "PARTITION");
- YYABORT;
- }
| UNION_SYM opt_equal '(' table_list ')'
{
/* Move the union list to the merge_list */
@@ -4120,11 +4100,6 @@ row_types:
| REDUNDANT_SYM { $$= ROW_TYPE_REDUNDANT; }
| COMPACT_SYM { $$= ROW_TYPE_COMPACT; };
-raid_types:
- RAID_STRIPED_SYM { $$= RAID_TYPE_0; }
- | RAID_0_SYM { $$= RAID_TYPE_0; }
- | ulong_num { $$=$1;};
-
merge_insert_types:
NO_SYM { $$= MERGE_INSERT_DISABLED; }
| FIRST_SYM { $$= MERGE_INSERT_TO_FIRST; }
@@ -9495,11 +9470,6 @@ keyword_sp:
| QUARTER_SYM {}
| QUERY_SYM {}
| QUICK {}
- | RAID_0_SYM {}
- | RAID_CHUNKS {}
- | RAID_CHUNKSIZE {}
- | RAID_STRIPED_SYM {}
- | RAID_TYPE {}
| REBUILD_SYM {}
| RECOVER_SYM {}
| REDO_BUFFER_SIZE_SYM {}
diff --git a/sql/table.cc b/sql/table.cc
index b7920d0d530..7e12d42ac57 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -438,9 +438,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{
share->avg_row_length= uint4korr(head+34);
share-> row_type= (row_type) head[40];
- share->raid_type= head[41];
- share->raid_chunks= head[42];
- share->raid_chunksize= uint4korr(head+43);
share->table_charset= get_charset((uint) head[38],MYF(0));
share->null_field_first= 1;
}
@@ -2021,12 +2018,6 @@ File create_frm(THD *thd, const char *name, const char *db,
if (create_info->min_rows > UINT_MAX32)
create_info->min_rows= UINT_MAX32;
- /*
- Ensure that raid_chunks can't be larger than 255, as this would cause
- problems with drop database
- */
- set_if_smaller(create_info->raid_chunks, 255);
-
if ((file= my_create(name, CREATE_MODE, create_flags, MYF(0))) >= 0)
{
uint key_length, tmp_key_length;
@@ -2059,9 +2050,13 @@ File create_frm(THD *thd, const char *name, const char *db,
fileinfo[38]= (create_info->default_table_charset ?
create_info->default_table_charset->number : 0);
fileinfo[40]= (uchar) create_info->row_type;
- fileinfo[41]= (uchar) create_info->raid_type;
- fileinfo[42]= (uchar) create_info->raid_chunks;
- int4store(fileinfo+43,create_info->raid_chunksize);
+ /* Next few bytes were for RAID support */
+ fileinfo[41]= 0;
+ fileinfo[42]= 0;
+ fileinfo[43]= 0;
+ fileinfo[44]= 0;
+ fileinfo[45]= 0;
+ fileinfo[46]= 0;
int4store(fileinfo+47, key_length);
tmp= MYSQL_VERSION_ID; // Store to avoid warning from int4store
int4store(fileinfo+51, tmp);
@@ -2098,9 +2093,6 @@ void update_create_info_from_table(HA_CREATE_INFO *create_info, TABLE *table)
create_info->table_options= share->db_create_options;
create_info->avg_row_length= share->avg_row_length;
create_info->row_type= share->row_type;
- create_info->raid_type= share->raid_type;
- create_info->raid_chunks= share->raid_chunks;
- create_info->raid_chunksize= share->raid_chunksize;
create_info->default_table_charset= share->table_charset;
create_info->table_charset= 0;
diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h
index de5ac44e73f..7f75e7e10a6 100644
--- a/storage/innobase/include/db0err.h
+++ b/storage/innobase/include/db0err.h
@@ -57,6 +57,10 @@ Created 5/24/1996 Heikki Tuuri
buffer pool (for big transactions,
InnoDB stores the lock structs in the
buffer pool) */
+#define DB_FOREIGN_DUPLICATE_KEY 46 /* foreign key constraints
+ activated by the operation would
+ lead to a duplicate key in some
+ table */
/* The following are partial failure codes */
#define DB_FAIL 1000
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index 15650f22ed8..dd4862b3808 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -126,14 +126,8 @@ by one. */
#ifdef __WIN__
#define UNIV_INLINE __inline
#else
-/* config.h contains the right def for 'inline' for the current compiler */
-#if (__GNUC__ == 2)
-#define UNIV_INLINE extern inline
-#else
-/* extern inline doesn't work with gcc 3.0.2 */
#define UNIV_INLINE static inline
#endif
-#endif
#else
/* If we want to compile a noninlined version we use the following macro
diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c
index 5e833372299..128b46f9aa4 100644
--- a/storage/innobase/row/row0ins.c
+++ b/storage/innobase/row/row0ins.c
@@ -1376,6 +1376,21 @@ run_again:
thr, foreign, &pcur, entry,
&mtr);
if (err != DB_SUCCESS) {
+ /* Since reporting a plain
+ "duplicate key" error
+ message to the user in
+ cases where a long CASCADE
+ operation would lead to a
+ duplicate key in some
+ other table is very
+ confusing, map duplicate
+ key errors resulting from
+ FK constraints to a
+ separate error code. */
+
+ if (err == DB_DUPLICATE_KEY) {
+ err = DB_FOREIGN_DUPLICATE_KEY;
+ }
break;
}
diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
index 86d9ecf9c54..a16ffc5aa41 100644
--- a/storage/innobase/row/row0mysql.c
+++ b/storage/innobase/row/row0mysql.c
@@ -473,8 +473,9 @@ handle_new_error:
ut_a(err != DB_SUCCESS);
trx->error_state = DB_SUCCESS;
-
- if (err == DB_DUPLICATE_KEY) {
+
+ if ((err == DB_DUPLICATE_KEY)
+ || (err == DB_FOREIGN_DUPLICATE_KEY)) {
if (savept) {
/* Roll back the latest, possibly incomplete
insertion or update */
diff --git a/storage/ndb/src/kernel/blocks/Makefile.am b/storage/ndb/src/kernel/blocks/Makefile.am
index d6e9f3f3352..05648653532 100644
--- a/storage/ndb/src/kernel/blocks/Makefile.am
+++ b/storage/ndb/src/kernel/blocks/Makefile.am
@@ -38,7 +38,7 @@ libblocks_a_SOURCES = tsman.cpp lgman.cpp pgman.cpp diskpage.cpp restore.cpp\
dbtux/DbtuxSearch.cpp dbtux/DbtuxCmp.cpp dbtux/DbtuxStat.cpp \
dbtux/DbtuxDebug.cpp
-ndbtools_PROGRAMS = ndb_print_file
+EXTRA_PROGRAMS = ndb_print_file
ndb_print_file_SOURCES = print_file.cpp diskpage.cpp dbtup/tuppage.cpp
ndb_print_file_LDFLAGS = @ndb_bin_am_ldflags@ \
$(top_builddir)/storage/ndb/src/libndbclient.la \
diff --git a/storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp b/storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp
index 2794990d608..5b1f85f1dd6 100644
--- a/storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp
+++ b/storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp
@@ -1061,7 +1061,7 @@ private:
Uint32 cexcPrevforward;
Uint32 clocalkey[32];
union {
- Uint32 ckeys[2048];
+ Uint32 ckeys[2048 * MAX_XFRM_MULTIPLY];
Uint64 ckeys_align;
};
diff --git a/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp b/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp
index 166917b00d2..31d877917e7 100644
--- a/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp
+++ b/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp
@@ -775,7 +775,7 @@ private:
//------------------------------------
// Methods for LCP functionality
//------------------------------------
- void checkKeepGci(Uint32 replicaStartIndex);
+ void checkKeepGci(TabRecordPtr, Uint32, Fragmentstore*, Uint32);
void checkLcpStart(Signal *, Uint32 lineNo);
void checkStartMoreLcp(Signal *, Uint32 nodeId);
bool reportLcpCompletion(const class LcpFragRep *);
@@ -1300,7 +1300,7 @@ private:
}
Uint32 lcpStart;
- Uint32 lcpStartGcp;
+ Uint32 lcpStopGcp;
Uint32 keepGci; /* USED TO CALCULATE THE GCI TO KEEP AFTER A LCP */
Uint32 oldestRestorableGci;
@@ -1369,7 +1369,8 @@ private:
Uint32 cstarttype;
Uint32 csystemnodes;
Uint32 currentgcp;
-
+ Uint32 c_newest_restorable_gci;
+
enum GcpMasterTakeOverState {
GMTOS_IDLE = 0,
GMTOS_INITIAL = 1,
diff --git a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
index b0fcfc342da..2c854da9609 100644
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
@@ -685,6 +685,7 @@ void Dbdih::execCOPY_GCIREQ(Signal* signal)
jam();
coldgcp = SYSFILE->newestRestorableGCI;
crestartGci = SYSFILE->newestRestorableGCI;
+ c_newest_restorable_gci = SYSFILE->newestRestorableGCI;
Sysfile::setRestartOngoing(SYSFILE->systemRestartBits);
currentgcp = coldgcp + 1;
cnewgcp = coldgcp + 1;
@@ -703,6 +704,7 @@ void Dbdih::execCOPY_GCIREQ(Signal* signal)
ok = true;
jam();
cgcpParticipantState = GCP_PARTICIPANT_COPY_GCI_RECEIVED;
+ c_newest_restorable_gci = SYSFILE->newestRestorableGCI;
setNodeInfo(signal);
break;
}//if
@@ -8039,6 +8041,8 @@ void Dbdih::execCOPY_GCICONF(Signal* signal)
signal->theData[1] = coldgcp;
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
+ c_newest_restorable_gci = coldgcp;
+
CRASH_INSERTION(7004);
emptyWaitGCPMasterQueue(signal);
cgcpStatus = GCP_READY;
@@ -9522,7 +9526,7 @@ void Dbdih::checkTcCounterLab(Signal* signal)
}//if
c_lcpState.ctimer += 32;
if ((c_nodeStartMaster.blockLcp == true) ||
- ((c_lcpState.lcpStartGcp + 1) > currentgcp)) {
+ (c_lcpState.lcpStopGcp >= c_newest_restorable_gci)) {
jam();
/* --------------------------------------------------------------------- */
// No reason to start juggling the states and checking for start of LCP if
@@ -9605,7 +9609,6 @@ void Dbdih::execTCGETOPSIZECONF(Signal* signal)
/* ----------------------------------------------------------------------- */
c_lcpState.ctimer = 0;
c_lcpState.keepGci = coldgcp;
- c_lcpState.lcpStartGcp = currentgcp;
/* ----------------------------------------------------------------------- */
/* UPDATE THE NEW LATEST LOCAL CHECKPOINT ID. */
/* ----------------------------------------------------------------------- */
@@ -9677,7 +9680,7 @@ void Dbdih::calculateKeepGciLab(Signal* signal, Uint32 tableId, Uint32 fragId)
cnoOfActiveTables++;
FragmentstorePtr fragPtr;
getFragstore(tabPtr.p, fragId, fragPtr);
- checkKeepGci(fragPtr.p->storedReplicas);
+ checkKeepGci(tabPtr, fragId, fragPtr.p, fragPtr.p->storedReplicas);
fragId++;
if (fragId >= tabPtr.p->totalfragments) {
jam();
@@ -10537,6 +10540,7 @@ void Dbdih::allNodesLcpCompletedLab(Signal* signal)
signal->theData[0] = NDB_LE_LocalCheckpointCompleted; //Event type
signal->theData[1] = SYSFILE->latestLCP_ID;
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
+ c_lcpState.lcpStopGcp = c_newest_restorable_gci;
/**
* Start checking for next LCP
@@ -10971,7 +10975,8 @@ void Dbdih::checkEscalation()
/* DESCRIPTION: CHECK FOR MINIMUM GCI RESTORABLE WITH NEW LOCAL */
/* CHECKPOINT. */
/*************************************************************************/
-void Dbdih::checkKeepGci(Uint32 replicaStartIndex)
+void Dbdih::checkKeepGci(TabRecordPtr tabPtr, Uint32 fragId, Fragmentstore*,
+ Uint32 replicaStartIndex)
{
ReplicaRecordPtr ckgReplicaPtr;
ckgReplicaPtr.i = replicaStartIndex;
@@ -10993,7 +10998,6 @@ void Dbdih::checkKeepGci(Uint32 replicaStartIndex)
if (oldestRestorableGci > c_lcpState.oldestRestorableGci) {
jam();
c_lcpState.oldestRestorableGci = oldestRestorableGci;
- ndbrequire(((int)c_lcpState.oldestRestorableGci) >= 0);
}//if
ckgReplicaPtr.i = ckgReplicaPtr.p->nextReplica;
}//while
@@ -11287,7 +11291,7 @@ void Dbdih::findMinGci(ReplicaRecordPtr fmgReplicaPtr,
do {
ndbrequire(lcpNo < MAX_LCP_STORED);
if (fmgReplicaPtr.p->lcpStatus[lcpNo] == ZVALID &&
- fmgReplicaPtr.p->maxGciStarted[lcpNo] <= coldgcp)
+ fmgReplicaPtr.p->maxGciStarted[lcpNo] < c_newest_restorable_gci)
{
jam();
keepGci = fmgReplicaPtr.p->maxGciCompleted[lcpNo];
@@ -11409,7 +11413,7 @@ void Dbdih::initCommonData()
c_lcpState.clcpDelay = 0;
c_lcpState.lcpStart = ZIDLE;
- c_lcpState.lcpStartGcp = 0;
+ c_lcpState.lcpStopGcp = 0;
c_lcpState.setLcpStatus(LCP_STATUS_IDLE, __LINE__);
c_lcpState.currentFragment.tableId = 0;
c_lcpState.currentFragment.fragmentId = 0;
@@ -11446,6 +11450,7 @@ void Dbdih::initCommonData()
csystemnodes = 0;
c_updateToLock = RNIL;
currentgcp = 0;
+ c_newest_restorable_gci = 0;
cverifyQueueCounter = 0;
cwaitLcpSr = false;
c_nextLogPart = 0;
@@ -11522,6 +11527,7 @@ void Dbdih::initRestartInfo()
currentgcp = 2;
cnewgcp = 2;
crestartGci = 1;
+ c_newest_restorable_gci = 1;
SYSFILE->keepGCI = 1;
SYSFILE->oldestRestorableGCI = 1;
@@ -13494,9 +13500,9 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal)
if (signal->theData[0] == 7001) {
infoEvent("c_lcpState.keepGci = %d",
c_lcpState.keepGci);
- infoEvent("c_lcpState.lcpStatus = %d, clcpStartGcp = %d",
+ infoEvent("c_lcpState.lcpStatus = %d, clcpStopGcp = %d",
c_lcpState.lcpStatus,
- c_lcpState.lcpStartGcp);
+ c_lcpState.lcpStopGcp);
infoEvent("cgcpStartCounter = %d, cimmediateLcpStart = %d",
cgcpStartCounter, c_lcpState.immediateLcpStart);
}//if
@@ -13677,8 +13683,8 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal)
infoEvent("lcpStatus = %d (update place = %d) ",
c_lcpState.lcpStatus, c_lcpState.lcpStatusUpdatedPlace);
infoEvent
- ("lcpStart = %d lcpStartGcp = %d keepGci = %d oldestRestorable = %d",
- c_lcpState.lcpStart, c_lcpState.lcpStartGcp,
+ ("lcpStart = %d lcpStopGcp = %d keepGci = %d oldestRestorable = %d",
+ c_lcpState.lcpStart, c_lcpState.lcpStopGcp,
c_lcpState.keepGci, c_lcpState.oldestRestorableGci);
infoEvent
diff --git a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
index eaf935da2c5..a6e731a64d1 100644
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
@@ -14738,7 +14738,9 @@ void Dblqh::execSr(Signal* signal)
signal->theData[4] = logFilePtr.p->currentFilepage;
signal->theData[5] = logFilePtr.p->currentMbyte;
signal->theData[6] = logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX];
- sendSignal(cownref, GSN_DEBUG_SIG, signal, 7, JBA);
+ signal->theData[7] = ~0;
+ signal->theData[8] = __LINE__;
+ sendSignal(cownref, GSN_DEBUG_SIG, signal, 9, JBA);
return;
}//if
}//if
@@ -14804,7 +14806,8 @@ void Dblqh::execSr(Signal* signal)
signal->theData[5] = logFilePtr.p->currentFilepage;
signal->theData[6] = logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX];
signal->theData[7] = logWord;
- sendSignal(cownref, GSN_DEBUG_SIG, signal, 8, JBA);
+ signal->theData[8] = __LINE__;
+ sendSignal(cownref, GSN_DEBUG_SIG, signal, 9, JBA);
return;
break;
}//switch
@@ -14833,8 +14836,9 @@ void Dblqh::execDEBUG_SIG(Signal* signal)
char buf[100];
BaseString::snprintf(buf, 100,
- "Error while reading REDO log.\n"
+ "Error while reading REDO log. from %d\n"
"D=%d, F=%d Mb=%d FP=%d W1=%d W2=%d",
+ signal->theData[8],
signal->theData[2], signal->theData[3], signal->theData[4],
signal->theData[5], signal->theData[6], signal->theData[7]);
@@ -15417,6 +15421,10 @@ void Dblqh::readSrFourthZeroLab(Signal* signal)
// to read a page from file.
lfoPtr.p->lfoState = LogFileOperationRecord::WRITE_SR_INVALIDATE_PAGES;
+ /**
+ * Make sure we dont release zero page
+ */
+ seizeLogpage(signal);
invalidateLogAfterLastGCI(signal);
return;
}//Dblqh::readSrFourthZeroLab()
diff --git a/storage/ndb/src/kernel/blocks/dbtup/Makefile.am b/storage/ndb/src/kernel/blocks/dbtup/Makefile.am
index 7a53f43817a..d963cdecaf9 100644
--- a/storage/ndb/src/kernel/blocks/dbtup/Makefile.am
+++ b/storage/ndb/src/kernel/blocks/dbtup/Makefile.am
@@ -5,7 +5,7 @@ include $(top_srcdir)/storage/ndb/config/type_kernel.mk.am
# Don't update the files from bitkeeper
%::SCCS/s.%
-ndbtest_PROGRAMS = test_varpage
+EXTRA_PROGRAMS = test_varpage
test_varpage_SOURCES = test_varpage.cpp tuppage.cpp
test_varpage_LDFLAGS = @ndb_bin_am_ldflags@ \
$(top_builddir)/storage/ndb/src/libndbclient.la \
diff --git a/storage/ndb/src/kernel/main.cpp b/storage/ndb/src/kernel/main.cpp
index 4bc9fbf76e5..7c1763485ce 100644
--- a/storage/ndb/src/kernel/main.cpp
+++ b/storage/ndb/src/kernel/main.cpp
@@ -63,8 +63,10 @@ extern "C" void handler_sigusr1(int signum); // child signalling failed restart
void systemInfo(const Configuration & conf,
const LogLevel & ll);
-static FILE *child_info_file_r= 0;
-static FILE *child_info_file_w= 0;
+// These are used already before fork if fetch_configuration() fails
+// (e.g. Unable to alloc node id). Set them to something reasonable.
+static FILE *child_info_file_r= stdin;
+static FILE *child_info_file_w= stdout;
static void writeChildInfo(const char *token, int val)
{
@@ -270,8 +272,8 @@ int main(int argc, char** argv)
#ifndef NDB_WIN32
signal(SIGUSR1, handler_sigusr1);
- pid_t child;
- while (1)
+ pid_t child = -1;
+ while (! theConfig->getForegroundMode()) // the cond is const
{
// setup reporting between child and parent
int filedes[2];
@@ -393,8 +395,10 @@ int main(int argc, char** argv)
if (child >= 0)
g_eventLogger.info("Angel pid: %d ndb pid: %d", getppid(), getpid());
- else
+ else if (child > 0)
g_eventLogger.info("Ndb pid: %d", getpid());
+ else
+ g_eventLogger.info("Ndb started in foreground");
#else
g_eventLogger.info("Ndb started");
#endif
@@ -569,10 +573,7 @@ catchsigs(bool ignore){
#ifdef SIGPOLL
SIGPOLL,
#endif
- SIGSEGV,
-#ifdef SIGTRAP
- SIGTRAP
-#endif
+ SIGSEGV
};
static const int signals_ignore[] = {
@@ -586,6 +587,11 @@ catchsigs(bool ignore){
handler_register(signals_error[i], handler_error, ignore);
for(i = 0; i < sizeof(signals_ignore)/sizeof(signals_ignore[0]); i++)
handler_register(signals_ignore[i], SIG_IGN, ignore);
+#ifdef SIGTRAP
+ Configuration* theConfig = globalEmulatorData.theConfiguration;
+ if (! theConfig->getForegroundMode())
+ handler_register(SIGTRAP, handler_error, ignore);
+#endif
#endif
}
diff --git a/storage/ndb/src/kernel/vm/Configuration.cpp b/storage/ndb/src/kernel/vm/Configuration.cpp
index 771fa6f5fe4..5f3b601023f 100644
--- a/storage/ndb/src/kernel/vm/Configuration.cpp
+++ b/storage/ndb/src/kernel/vm/Configuration.cpp
@@ -48,11 +48,13 @@ extern EventLogger g_eventLogger;
enum ndbd_options {
OPT_INITIAL = NDB_STD_OPTIONS_LAST,
- OPT_NODAEMON
+ OPT_NODAEMON,
+ OPT_FOREGROUND
};
NDB_STD_OPTS_VARS;
-static int _daemon, _no_daemon, _initial, _no_start;
+// XXX should be my_bool ???
+static int _daemon, _no_daemon, _foreground, _initial, _no_start;
/**
* Arguments to NDB process
*/
@@ -75,6 +77,11 @@ static struct my_option my_long_options[] =
"Do not start ndbd as daemon, provided for testing purposes",
(gptr*) &_no_daemon, (gptr*) &_no_daemon, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "foreground", OPT_FOREGROUND,
+ "Run real ndbd in foreground, provided for debugging purposes"
+ " (implies --nodaemon)",
+ (gptr*) &_foreground, (gptr*) &_foreground, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static void short_usage_sub(void)
@@ -103,13 +110,14 @@ Configuration::init(int argc, char** argv)
ndb_std_get_one_option)))
exit(ho_error);
- if (_no_daemon) {
+ if (_no_daemon || _foreground) {
_daemon= 0;
}
DBUG_PRINT("info", ("no_start=%d", _no_start));
DBUG_PRINT("info", ("initial=%d", _initial));
DBUG_PRINT("info", ("daemon=%d", _daemon));
+ DBUG_PRINT("info", ("foreground=%d", _foreground));
DBUG_PRINT("info", ("connect_str=%s", opt_connect_str));
ndbSetOwnVersion();
@@ -131,6 +139,8 @@ Configuration::init(int argc, char** argv)
// Check daemon flag
if (_daemon)
_daemonMode = true;
+ if (_foreground)
+ _foregroundMode = true;
// Save programname
if(argc > 0 && argv[0] != 0)
@@ -151,6 +161,7 @@ Configuration::Configuration()
_backupPath = 0;
_initialStart = false;
_daemonMode = false;
+ _foregroundMode = false;
m_config_retriever= 0;
m_clusterConfig= 0;
m_clusterConfigIter= 0;
diff --git a/storage/ndb/src/kernel/vm/Configuration.hpp b/storage/ndb/src/kernel/vm/Configuration.hpp
index 243ecbee4e7..6315209ddbb 100644
--- a/storage/ndb/src/kernel/vm/Configuration.hpp
+++ b/storage/ndb/src/kernel/vm/Configuration.hpp
@@ -64,6 +64,7 @@ public:
bool getInitialStart() const;
void setInitialStart(bool val);
bool getDaemonMode() const;
+ bool getForegroundMode() const;
const ndb_mgm_configuration_iterator * getOwnConfigIterator() const;
@@ -105,7 +106,8 @@ private:
char * _connectString;
Uint32 m_mgmd_port;
BaseString m_mgmd_host;
- bool _daemonMode;
+ bool _daemonMode; // if not, angel in foreground
+ bool _foregroundMode; // no angel, raw ndbd in foreground
void calcSizeAlt(class ConfigValues * );
};
@@ -140,4 +142,10 @@ Configuration::getDaemonMode() const {
return _daemonMode;
}
+inline
+bool
+Configuration::getForegroundMode() const {
+ return _foregroundMode;
+}
+
#endif
diff --git a/storage/ndb/test/ndbapi/testBlobs.cpp b/storage/ndb/test/ndbapi/testBlobs.cpp
index 506ff188ff6..fff5ac247df 100644
--- a/storage/ndb/test/ndbapi/testBlobs.cpp
+++ b/storage/ndb/test/ndbapi/testBlobs.cpp
@@ -839,9 +839,6 @@ insertPk(int style)
CHK(g_con->execute(NoCommit) == 0);
CHK(writeBlobData(tup) == 0);
}
- // just another trap
- if (urandom(10) == 0)
- CHK(g_con->execute(NoCommit) == 0);
if (++n == g_opt.m_batch) {
CHK(g_con->execute(Commit) == 0);
g_ndb->closeTransaction(g_con);
@@ -963,21 +960,31 @@ static int
deletePk()
{
DBG("--- deletePk ---");
+ unsigned n = 0;
+ CHK((g_con = g_ndb->startTransaction()) != 0);
for (unsigned k = 0; k < g_opt.m_rows; k++) {
Tup& tup = g_tups[k];
DBG("deletePk pk1=" << hex << tup.m_pk1);
- CHK((g_con = g_ndb->startTransaction()) != 0);
CHK((g_opr = g_con->getNdbOperation(g_opt.m_tname)) != 0);
CHK(g_opr->deleteTuple() == 0);
CHK(g_opr->equal("PK1", tup.m_pk1) == 0);
if (g_opt.m_pk2len != 0)
CHK(g_opr->equal("PK2", tup.m_pk2) == 0);
- CHK(g_con->execute(Commit) == 0);
- g_ndb->closeTransaction(g_con);
+ if (++n == g_opt.m_batch) {
+ CHK(g_con->execute(Commit) == 0);
+ g_ndb->closeTransaction(g_con);
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ n = 0;
+ }
g_opr = 0;
- g_con = 0;
tup.m_exists = false;
}
+ if (n != 0) {
+ CHK(g_con->execute(Commit) == 0);
+ n = 0;
+ }
+ g_ndb->closeTransaction(g_con);
+ g_con = 0;
return 0;
}
@@ -1080,19 +1087,27 @@ static int
deleteIdx()
{
DBG("--- deleteIdx ---");
+ unsigned n = 0;
+ CHK((g_con = g_ndb->startTransaction()) != 0);
for (unsigned k = 0; k < g_opt.m_rows; k++) {
Tup& tup = g_tups[k];
DBG("deleteIdx pk1=" << hex << tup.m_pk1);
- CHK((g_con = g_ndb->startTransaction()) != 0);
CHK((g_opx = g_con->getNdbIndexOperation(g_opt.m_x1name, g_opt.m_tname)) != 0);
CHK(g_opx->deleteTuple() == 0);
CHK(g_opx->equal("PK2", tup.m_pk2) == 0);
- CHK(g_con->execute(Commit) == 0);
- g_ndb->closeTransaction(g_con);
+ if (++n == g_opt.m_batch) {
+ CHK(g_con->execute(Commit) == 0);
+ g_ndb->closeTransaction(g_con);
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ n = 0;
+ }
g_opx = 0;
- g_con = 0;
tup.m_exists = false;
}
+ if (n != 0) {
+ CHK(g_con->execute(Commit) == 0);
+ n = 0;
+ }
return 0;
}
@@ -1220,20 +1235,49 @@ deleteScan(bool idx)
CHK(g_ops->getValue("PK2", tup.m_pk2) != 0);
CHK(g_con->execute(NoCommit) == 0);
unsigned rows = 0;
+ unsigned n = 0;
while (1) {
int ret;
tup.m_pk1 = (Uint32)-1;
memset(tup.m_pk2, 'x', g_opt.m_pk2len);
- CHK((ret = g_ops->nextResult()) == 0 || ret == 1);
+ CHK((ret = g_ops->nextResult(true)) == 0 || ret == 1);
if (ret == 1)
break;
- DBG("deleteScan" << (idx ? "Idx" : "") << " pk1=" << hex << tup.m_pk1);
- CHK(g_ops->deleteCurrentTuple() == 0);
- CHK(g_con->execute(NoCommit) == 0);
- Uint32 k = tup.m_pk1 - g_opt.m_pk1off;
- CHK(k < g_opt.m_rows && g_tups[k].m_exists);
- g_tups[k].m_exists = false;
- rows++;
+ while (1) {
+ DBG("deleteScan" << (idx ? "Idx" : "") << " pk1=" << hex << tup.m_pk1);
+ Uint32 k = tup.m_pk1 - g_opt.m_pk1off;
+ CHK(k < g_opt.m_rows && g_tups[k].m_exists);
+ g_tups[k].m_exists = false;
+ CHK(g_ops->deleteCurrentTuple() == 0);
+ rows++;
+ tup.m_pk1 = (Uint32)-1;
+ memset(tup.m_pk2, 'x', g_opt.m_pk2len);
+ CHK((ret = g_ops->nextResult(false)) == 0 || ret == 1 || ret == 2);
+ if (++n == g_opt.m_batch || ret == 2) {
+ DBG("execute batch: n=" << n << " ret=" << ret);
+ switch (0) {
+ case 0: // works normally
+ CHK(g_con->execute(NoCommit) == 0);
+ CHK(true || g_con->restart() == 0);
+ break;
+ case 1: // nonsense - g_con is invalid for 2nd batch
+ CHK(g_con->execute(Commit) == 0);
+ CHK(true || g_con->restart() == 0);
+ break;
+ case 2: // DBTC sendSignalErrorRefuseLab
+ CHK(g_con->execute(NoCommit) == 0);
+ CHK(g_con->restart() == 0);
+ break;
+ case 3: // 266 time-out
+ CHK(g_con->execute(Commit) == 0);
+ CHK(g_con->restart() == 0);
+ break;
+ }
+ n = 0;
+ }
+ if (ret == 2)
+ break;
+ }
}
CHK(g_con->execute(Commit) == 0);
g_ndb->closeTransaction(g_con);
@@ -1256,7 +1300,7 @@ static int
testmain()
{
g_ndb = new Ndb(g_ncc, "TEST_DB");
- CHK(g_ndb->init() == 0);
+ CHK(g_ndb->init(20) == 0);
CHK(g_ndb->waitUntilReady() == 0);
g_dic = g_ndb->getDictionary();
g_tups = new Tup [g_opt.m_rows];
diff --git a/storage/ndb/tools/delete_all.cpp b/storage/ndb/tools/delete_all.cpp
index 6b7453d4d55..feedded06ad 100644
--- a/storage/ndb/tools/delete_all.cpp
+++ b/storage/ndb/tools/delete_all.cpp
@@ -22,7 +22,8 @@
#include
#include
-static int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism=240);
+static int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab,
+ bool commit_across_open_cursor, int parallelism=240);
NDB_STD_OPTS_VARS;
@@ -83,8 +84,18 @@ int main(int argc, char** argv){
ndbout << " Table " << argv[i] << " does not exist!" << endl;
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
+ // Check if we have any blobs
+ bool commit_across_open_cursor = true;
+ for (int j = 0; j < pTab->getNoOfColumns(); j++) {
+ NdbDictionary::Column::Type t = pTab->getColumn(j)->getType();
+ if (t == NdbDictionary::Column::Blob ||
+ t == NdbDictionary::Column::Text) {
+ commit_across_open_cursor = false;
+ break;
+ }
+ }
ndbout << "Deleting all from " << argv[i] << "...";
- if(clear_table(&MyNdb, pTab) == NDBT_FAILED){
+ if(clear_table(&MyNdb, pTab, commit_across_open_cursor) == NDBT_FAILED){
res = NDBT_FAILED;
ndbout << "FAILED" << endl;
}
@@ -93,7 +104,8 @@ int main(int argc, char** argv){
}
-int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism)
+int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab,
+ bool commit_across_open_cursor, int parallelism)
{
// Scan all records exclusive and delete
// them one by one
@@ -155,8 +167,12 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism)
} while((check = pOp->nextResult(false)) == 0);
if(check != -1){
- check = pTrans->execute(NdbTransaction::Commit);
- pTrans->restart();
+ if (commit_across_open_cursor) {
+ check = pTrans->execute(NdbTransaction::Commit);
+ pTrans->restart(); // new tx id
+ } else {
+ check = pTrans->execute(NdbTransaction::NoCommit);
+ }
}
err = pTrans->getNdbError();
@@ -182,6 +198,11 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism)
}
goto failed;
}
+ if (! commit_across_open_cursor &&
+ pTrans->execute(NdbTransaction::Commit) != 0) {
+ err = pTrans->getNdbError();
+ goto failed;
+ }
pNdb->closeTransaction(pTrans);
return NDBT_OK;
}
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 3242b18dd42..62f2bdb668d 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -114,8 +114,6 @@ Group: Applications/Databases
This package contains the ndbcluster storage engine.
It is necessary to have this package installed on all
computers that should store ndbcluster table data.
-Note that this storage engine can only be used in conjunction
-with the MySQL Max server.
%{see_base}
@@ -181,29 +179,6 @@ Group: Applications/Databases
This package contains the shared libraries (*.so*) which certain
languages and applications need to dynamically load and use MySQL.
-%package Max
-Summary: MySQL - server with extended functionality
-Group: Applications/Databases
-Provides: mysql-Max
-Obsoletes: mysql-Max
-Requires: MySQL-server >= @MYSQL_BASE_VERSION@
-
-%description Max
-Optional MySQL server binary that supports additional features like:
-
- - Berkeley DB Storage Engine
- - Ndbcluster Storage Engine interface
- - Archive Storage Engine
- - CSV Storage Engine
- - Example Storage Engine
- - Federated Storage Engine
- - User Defined Functions (UDFs).
-
-To activate this binary, just install this package in addition to
-the standard MySQL package.
-
-Please note that this is a dynamically linked binary!
-
%package embedded
Requires: %{name}-devel
Summary: MySQL - embedded library
@@ -224,7 +199,11 @@ client/server version.
%{see_base}
%prep
-%setup -n mysql-%{mysql_version}
+# We unpack the source twice, once for debug and once for release build.
+%setup -T -a 0 -c -n mysql-%{mysql_version}
+mv mysql-%{mysql_version} mysql-debug-%{mysql_version}
+%setup -D -T -a 0 -n mysql-%{mysql_version}
+mv mysql-%{mysql_version} mysql-release-%{mysql_version}
%build
@@ -234,12 +213,13 @@ BuildMySQL() {
sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
CC=\"${CC:-$MYSQL_BUILD_CC}\" \
CXX=\"${CXX:-$MYSQL_BUILD_CXX}\" \
- CFLAGS=\"${MYSQL_BUILD_CFLAGS:-$RPM_OPT_FLAGS}\" \
- CXXFLAGS=\"${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS \
- -felide-constructors -fno-exceptions -fno-rtti \
- }\" \
+ CFLAGS=\"$CFLAGS\" \
+ CXXFLAGS=\"$CXXFLAGS\" \
./configure \
$* \
+ --with-mysqld-ldflags='-static' \
+ --with-client-ldflags='-static' \
+ --with-zlib-dir=bundled \
--enable-assembler \
--enable-local-infile \
--with-mysqld-user=%{mysqld_user} \
@@ -280,7 +260,6 @@ fi
# Use the build root for temporary storage of the shared libraries.
RBR=$RPM_BUILD_ROOT
-MBD=$RPM_BUILD_DIR/mysql-%{mysql_version}
# Clean up the BuildRoot first
[ "$RBR" != "/" ] && [ -d $RBR ] && rm -rf $RBR;
@@ -292,8 +271,7 @@ mkdir -p $RBR%{_libdir}/mysql
PATH=${MYSQL_BUILD_PATH:-/bin:/usr/bin}
export PATH
-# Build the Max binary (includes BDB and UDFs and therefore
-# cannot be linked statically against the patched glibc)
+# Build the Debug binary.
# Use gcc for C and C++ code (to avoid a dependency on libstdc++ and
# including exceptions into the code
@@ -303,6 +281,35 @@ then
export CXX="gcc"
fi
+# Strip -Oxxx, add -g and --with-debug.
+(cd mysql-debug-%{mysql_version} &&
+CFLAGS=`echo "${MYSQL_BUILD_CFLAGS:-$RPM_OPT_FLAGS} -g" | sed -e 's/-O[0-9]*//g'` \
+CXXFLAGS=`echo "${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti} -g" | sed -e 's/-O[0-9]*//g'` \
+BuildMySQL "--enable-shared \
+ --with-debug \
+ --with-berkeley-db \
+ --with-innodb \
+ --with-ndbcluster \
+ --with-archive-storage-engine \
+ --with-csv-storage-engine \
+ --with-example-storage-engine \
+ --with-blackhole-storage-engine \
+ --with-federated-storage-engine \
+ --with-big-tables \
+ --with-comment=\"MySQL Community Edition - Debug (GPL)\"")
+
+# We might want to save the config log file
+if test -n "$MYSQL_DEBUGCONFLOG_DEST"
+then
+ cp -fp mysql-debug-%{mysql_version}/config.log "$MYSQL_DEBUGCONFLOG_DEST"
+fi
+
+(cd mysql-debug-%{mysql_version} && make test-force) || true
+
+# Build release binary.
+(cd mysql-release-%{mysql_version} &&
+CFLAGS="${MYSQL_BUILD_CFLAGS:-$RPM_OPT_FLAGS} -g" \
+CXXFLAGS="${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti} -g" \
BuildMySQL "--enable-shared \
--with-berkeley-db \
--with-innodb \
@@ -313,86 +320,19 @@ BuildMySQL "--enable-shared \
--with-blackhole-storage-engine \
--with-federated-storage-engine \
--with-big-tables \
- --with-comment=\"MySQL Community Edition - Experimental (GPL)\" \
- --with-server-suffix='-max'"
-
-# We might want to save the config log file
-if test -n "$MYSQL_MAXCONFLOG_DEST"
-then
- cp -fp config.log "$MYSQL_MAXCONFLOG_DEST"
-fi
-
-make test-force || true
-
-# Save mysqld-max
-# check if mysqld was installed in .libs/
-if test -f sql/.libs/mysqld
-then
- cp sql/.libs/mysqld sql/mysqld-max
-else
- cp sql/mysqld sql/mysqld-max
-fi
-nm --numeric-sort sql/mysqld-max > sql/mysqld-max.sym
-# Save the perror binary so it supports the NDB error codes (BUG#13740)
-mv extra/perror extra/perror.ndb
-
-# Install the ndb binaries
-(cd ndb; make install DESTDIR=$RBR)
-
-# Include libgcc.a in the devel subpackage (BUG 4921)
-if expr "$CC" : ".*gcc.*" > /dev/null ;
-then
- libgcc=`$CC --print-libgcc-file`
- if [ -f $libgcc ]
- then
- %define have_libgcc 1
- install -m 644 $libgcc $RBR%{_libdir}/mysql/libmygcc.a
- fi
-fi
-
-# Save libraries
-(cd libmysql/.libs; tar cf $RBR/shared-libs.tar *.so*)
-(cd libmysql_r/.libs; tar rf $RBR/shared-libs.tar *.so*)
-(cd ndb/src/.libs; tar rf $RBR/shared-libs.tar *.so*)
-
-# Now clean up
-make clean
-
-#
-# Only link statically on our i386 build host (which has a specially
-# patched static glibc installed) - ia64 and x86_64 run glibc-2.3 (unpatched)
-# so don't link statically there
-#
-BuildMySQL "--disable-shared \
-%if %{STATIC_BUILD}
- --with-mysqld-ldflags='-all-static' \
- --with-client-ldflags='-all-static' \
- $USE_OTHER_LIBC_DIR \
-%endif
- --with-zlib-dir=bundled \
- --with-comment=\"MySQL Community Edition - Standard (GPL)\" \
- --with-server-suffix='%{server_suffix}' \
- --with-archive-storage-engine \
- --with-innodb \
- --with-big-tables"
-if test -f sql/.libs/mysqld
-then
- nm --numeric-sort sql/.libs/mysqld > sql/mysqld.sym
-else
- nm --numeric-sort sql/mysqld > sql/mysqld.sym
-fi
+ --with-comment=\"MySQL Community Edition (GPL)\"")
# We might want to save the config log file
if test -n "$MYSQL_CONFLOG_DEST"
then
- cp -fp config.log "$MYSQL_CONFLOG_DEST"
+ cp -fp mysql-release-%{mysql_version}/config.log "$MYSQL_CONFLOG_DEST"
fi
-make test-force || true
+(cd mysql-release-%{mysql_version} && make test-force) || true
%install
RBR=$RPM_BUILD_ROOT
-MBD=$RPM_BUILD_DIR/mysql-%{mysql_version}
+MBD=$RPM_BUILD_DIR/mysql-%{mysql_version}/mysql-release-%{mysql_version}
# Ensure that needed directories exists
install -d $RBR%{_sysconfdir}/{logrotate.d,init.d}
@@ -404,21 +344,22 @@ install -d $RBR%{_mandir}
install -d $RBR%{_sbindir}
-# Install all binaries stripped
-make install-strip DESTDIR=$RBR benchdir_root=%{_datadir}
+# Install all binaries
+(cd $MBD && make install DESTDIR=$RBR benchdir_root=%{_datadir})
+# Old packages put shared libs in %{_libdir}/ (not %{_libdir}/mysql), so do
+# the same here.
+mv $RBR/%{_libdir}/mysql/*.so* $RBR/%{_libdir}/
-# Install shared libraries (Disable for architectures that don't support it)
-(cd $RBR%{_libdir}; tar xf $RBR/shared-libs.tar; rm -f $RBR/shared-libs.tar)
-
-# install saved mysqld-max
-install -s -m 755 $MBD/sql/mysqld-max $RBR%{_sbindir}/mysqld-max
+# install mysqld-debug
+if test -f $RPM_BUILD_DIR/mysql-%{mysql_version}/mysql-debug-%{mysql_version}/sql/.libs/mysqld
+then
+ install -m 755 $RPM_BUILD_DIR/mysql-%{mysql_version}/mysql-debug-%{mysql_version}/sql/.libs/mysqld $RBR%{_sbindir}/mysqld-debug
+else
+ install -m 755 $RPM_BUILD_DIR/mysql-%{mysql_version}/mysql-debug-%{mysql_version}/sql/mysqld $RBR%{_sbindir}/mysqld-debug
+fi
# install saved perror binary with NDB support (BUG#13740)
-install -s -m 755 $MBD/extra/perror.ndb $RBR%{_bindir}/perror
-
-# install symbol files ( for stack trace resolution)
-install -m 644 $MBD/sql/mysqld-max.sym $RBR%{_libdir}/mysql/mysqld-max.sym
-install -m 644 $MBD/sql/mysqld.sym $RBR%{_libdir}/mysql/mysqld.sym
+install -m 755 $MBD/extra/perror $RBR%{_bindir}/perror
# Install logrotate and autostart
install -m 644 $MBD/support-files/mysql-log-rotate $RBR%{_sysconfdir}/logrotate.d/mysql
@@ -510,11 +451,6 @@ mysql_clusterdir=/var/lib/mysql-cluster
if test ! -d $mysql_clusterdir; then mkdir -m 755 $mysql_clusterdir; fi
-%post Max
-# Restart mysqld, to use the new binary.
-echo "Restarting mysqld."
-%{_sysconfdir}/init.d/mysql restart > /dev/null 2>&1
-
%preun server
if test $1 = 0
then
@@ -546,9 +482,9 @@ fi
%files server
%defattr(-,root,root,0755)
-%doc COPYING README
-%doc support-files/my-*.cnf
-%doc support-files/ndb-*.ini
+%doc mysql-release-%{mysql_version}/COPYING mysql-release-%{mysql_version}/README
+%doc mysql-release-%{mysql_version}/support-files/my-*.cnf
+%doc mysql-release-%{mysql_version}/support-files/ndb-*.ini
%doc %attr(644, root, root) %{_infodir}/mysql.info*
@@ -597,9 +533,9 @@ fi
%attr(755, root, root) %{_bindir}/safe_mysqld
%attr(755, root, root) %{_sbindir}/mysqld
+%attr(755, root, root) %{_sbindir}/mysqld-debug
%attr(755, root, root) %{_sbindir}/mysqlmanager
%attr(755, root, root) %{_sbindir}/rcmysql
-%attr(644, root, root) %{_libdir}/mysql/mysqld.sym
%attr(644, root, root) %config(noreplace,missingok) %{_sysconfdir}/logrotate.d/mysql
%attr(755, root, root) %{_sysconfdir}/init.d/mysql
@@ -631,6 +567,7 @@ fi
%doc %attr(644, root, man) %{_mandir}/man1/mysqldump.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlimport.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlshow.1*
+%doc %attr(644, root, man) %{_mandir}/man1/mysqlslap.1*
%post shared
/sbin/ldconfig
@@ -666,7 +603,7 @@ fi
%files devel
%defattr(-, root, root, 0755)
-%doc EXCEPTIONS-CLIENT
+%doc mysql-release-%{mysql_version}/EXCEPTIONS-CLIENT
%doc %attr(644, root, man) %{_mandir}/man1/mysql_config.1*
%attr(755, root, root) %{_bindir}/comp_err
%attr(755, root, root) %{_bindir}/mysql_config
@@ -675,9 +612,6 @@ fi
%{_includedir}/mysql/*
%{_libdir}/mysql/libdbug.a
%{_libdir}/mysql/libheap.a
-%if %{have_libgcc}
-%{_libdir}/mysql/libmygcc.a
-%endif
%{_libdir}/mysql/libmyisam.a
%{_libdir}/mysql/libmyisammrg.a
%{_libdir}/mysql/libmysqlclient.a
@@ -706,11 +640,6 @@ fi
%attr(755, root, root) %{_bindir}/mysqltestmanager-pwgen
%attr(755, root, root) %{_bindir}/mysqltestmanagerc
-%files Max
-%defattr(-, root, root, 0755)
-%attr(755, root, root) %{_sbindir}/mysqld-max
-%attr(644, root, root) %{_libdir}/mysql/mysqld-max.sym
-
%files embedded
%defattr(-, root, root, 0755)
# %attr(644, root, root) %{_libdir}/mysql/libmysqld.a
diff --git a/tests/fork_big.pl b/tests/fork_big.pl
index c72eb59946b..5c4f11b00e2 100755
--- a/tests/fork_big.pl
+++ b/tests/fork_big.pl
@@ -65,7 +65,7 @@ if (!$opt_skip_create)
}
# Create the table we use to signal that we should end the test
$dbh->do("drop table if exists $abort_table");
- $dbh->do("create table $abort_table (id int(6) not null) type=heap") ||
+ $dbh->do("create table $abort_table (id int(6) not null) ENGINE=heap") ||
die $DBI::errstr;
}
diff --git a/tests/fork_big2.pl b/tests/fork_big2.pl
index 567cfafa176..8a0c5e317a0 100644
--- a/tests/fork_big2.pl
+++ b/tests/fork_big2.pl
@@ -89,7 +89,7 @@ if (!$opt_skip_create)
}
# Create the table we use to signal that we should end the test
$dbh->do("drop table if exists $abort_table");
- $dbh->do("create table $abort_table (id int(6) not null) type=heap") ||
+ $dbh->do("create table $abort_table (id int(6) not null) ENGINE=heap") ||
die $DBI::errstr;
}
diff --git a/tests/mail_to_db.pl b/tests/mail_to_db.pl
index 5ceda392313..e50415d96f3 100755
--- a/tests/mail_to_db.pl
+++ b/tests/mail_to_db.pl
@@ -253,7 +253,7 @@ CREATE TABLE my_mail
KEY (message_id),
KEY (in_reply_to),
PRIMARY KEY (mail_from, date, hash))
- TYPE=MyISAM COMMENT=''
+ ENGINE=MyISAM COMMENT=''
EOF
$sth = $dbh->prepare($query) or die $DBI::errstr;
$sth->execute() or die "Couldn't create table: $DBI::errstr\n";
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 85aee1210d1..e737cad0ef1 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -1201,7 +1201,7 @@ static void test_tran_bdb()
/* create the table 'mytran_demo' of type BDB' or 'InnoDB' */
rc= mysql_query(mysql, "CREATE TABLE my_demo_transaction( "
- "col1 int , col2 varchar(30)) TYPE= BDB");
+ "col1 int , col2 varchar(30)) ENGINE= BDB");
myquery(rc);
/* insert a row and commit the transaction */
@@ -1274,7 +1274,7 @@ static void test_tran_innodb()
/* create the table 'mytran_demo' of type BDB' or 'InnoDB' */
rc= mysql_query(mysql, "CREATE TABLE my_demo_transaction(col1 int, "
- "col2 varchar(30)) TYPE= InnoDB");
+ "col2 varchar(30)) ENGINE= InnoDB");
myquery(rc);
/* insert a row and commit the transaction */
@@ -9798,7 +9798,7 @@ static void test_derived()
myquery(rc);
rc= mysql_query(mysql, "create table t1 (id int(8), primary key (id)) \
-TYPE=InnoDB DEFAULT CHARSET=utf8");
+ENGINE=InnoDB DEFAULT CHARSET=utf8");
myquery(rc);
rc= mysql_query(mysql, "insert into t1 values (1)");
@@ -9846,16 +9846,16 @@ static void test_xjoin()
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1, t2, t3, t4");
myquery(rc);
- rc= mysql_query(mysql, "create table t3 (id int(8), param1_id int(8), param2_id int(8)) TYPE=InnoDB DEFAULT CHARSET=utf8");
+ rc= mysql_query(mysql, "create table t3 (id int(8), param1_id int(8), param2_id int(8)) ENGINE=InnoDB DEFAULT CHARSET=utf8");
myquery(rc);
- rc= mysql_query(mysql, "create table t1 ( id int(8), name_id int(8), value varchar(10)) TYPE=InnoDB DEFAULT CHARSET=utf8");
+ rc= mysql_query(mysql, "create table t1 ( id int(8), name_id int(8), value varchar(10)) ENGINE=InnoDB DEFAULT CHARSET=utf8");
myquery(rc);
- rc= mysql_query(mysql, "create table t2 (id int(8), name_id int(8), value varchar(10)) TYPE=InnoDB DEFAULT CHARSET=utf8;");
+ rc= mysql_query(mysql, "create table t2 (id int(8), name_id int(8), value varchar(10)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
myquery(rc);
- rc= mysql_query(mysql, "create table t4(id int(8), value varchar(10)) TYPE=InnoDB DEFAULT CHARSET=utf8");
+ rc= mysql_query(mysql, "create table t4(id int(8), value varchar(10)) ENGINE=InnoDB DEFAULT CHARSET=utf8");
myquery(rc);
rc= mysql_query(mysql, "insert into t3 values (1, 1, 1), (2, 2, null)");
@@ -14387,7 +14387,7 @@ static void test_bug14210()
itself is not InnoDB related. In case the table is MyISAM this test
is harmless.
*/
- mysql_query(mysql, "create table t1 (a varchar(255)) type=InnoDB");
+ mysql_query(mysql, "create table t1 (a varchar(255)) engine=InnoDB");
rc= mysql_query(mysql, "insert into t1 (a) values (repeat('a', 256))");
myquery(rc);
rc= mysql_query(mysql, "set @@session.max_heap_table_size=16384");
@@ -14708,8 +14708,7 @@ static void test_bug12744()
rc= mysql_stmt_prepare(prep_stmt, "SELECT 1", 8);
DIE_UNLESS(rc==0);
- rc= mysql_kill(mysql, mysql_thread_id(mysql));
- DIE_UNLESS(rc==0);
+ mysql_close(mysql);
if (rc= mysql_stmt_execute(prep_stmt))
{
@@ -14727,6 +14726,7 @@ static void test_bug12744()
DIE_UNLESS(1==0);
}
rc= mysql_stmt_close(prep_stmt);
+ client_connect(0);
}
/* Bug #16144: mysql_stmt_attr_get type error */