Commit ba7035ab authored by msvensson@neptunus.(none)'s avatar msvensson@neptunus.(none)

Merge bk-internal:/home/bk/mysql-5.1-new-maint

into  neptunus.(none):/home/msvensson/mysql/mysql-5.1-new-maint
parents ebf482c4 906d1777
...@@ -692,6 +692,7 @@ mysql-test/*.ds? ...@@ -692,6 +692,7 @@ mysql-test/*.ds?
mysql-test/*.vcproj mysql-test/*.vcproj
mysql-test/gmon.out mysql-test/gmon.out
mysql-test/install_test_db mysql-test/install_test_db
mysql-test/mtr
mysql-test/mysql-test-run mysql-test/mysql-test-run
mysql-test/mysql-test-run.log mysql-test/mysql-test-run.log
mysql-test/mysql_test_run_new mysql-test/mysql_test_run_new
......
...@@ -24,7 +24,7 @@ benchdir_root= $(prefix) ...@@ -24,7 +24,7 @@ benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test testdir = $(benchdir_root)/mysql-test
EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh valgrind.supp $(PRESCRIPTS) EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh valgrind.supp $(PRESCRIPTS)
EXTRA_DIST = $(EXTRA_SCRIPTS) EXTRA_DIST = $(EXTRA_SCRIPTS)
GENSCRIPTS = mysql-test-run install_test_db GENSCRIPTS = mysql-test-run install_test_db mtr
PRESCRIPTS = mysql-test-run.pl PRESCRIPTS = mysql-test-run.pl
test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS) test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
test_DATA = std_data/client-key.pem std_data/client-cert.pem \ test_DATA = std_data/client-key.pem std_data/client-cert.pem \
...@@ -113,6 +113,10 @@ install-data-local: ...@@ -113,6 +113,10 @@ install-data-local:
uninstall-local: uninstall-local:
@RM@ -f -r $(DESTDIR)$(testdir) @RM@ -f -r $(DESTDIR)$(testdir)
# mtr - a shortcut for executing mysql-test-run.pl
mtr:
$(RM) -f mtr
$(LN_S) mysql-test-run.pl mtr
SUFFIXES = .sh SUFFIXES = .sh
......
...@@ -469,14 +469,6 @@ sub collect_one_test_case($$$$$$$) { ...@@ -469,14 +469,6 @@ sub collect_one_test_case($$$$$$$) {
{ {
mtr_options_from_test_file($tinfo,"$testdir/${tname}.test"); mtr_options_from_test_file($tinfo,"$testdir/${tname}.test");
if ( ! $tinfo->{'innodb_test'} )
{
# mtr_verbose("Adding '--skip-innodb' to $tinfo->{'name'}");
# FIXME activate the --skip-innodb only when running with
# selected test cases
# push(@{$tinfo->{'master_opt'}}, "--skip-innodb");
}
if ( $tinfo->{'big_test'} and ! $::opt_big_test ) if ( $tinfo->{'big_test'} and ! $::opt_big_test )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
......
...@@ -139,6 +139,8 @@ sub mtr_copy_dir($$) { ...@@ -139,6 +139,8 @@ sub mtr_copy_dir($$) {
my $from_dir= shift; my $from_dir= shift;
my $to_dir= shift; my $to_dir= shift;
# mtr_verbose("Copying from $from_dir to $to_dir");
mkpath("$to_dir"); mkpath("$to_dir");
opendir(DIR, "$from_dir") opendir(DIR, "$from_dir")
or mtr_error("Can't find $from_dir$!"); or mtr_error("Can't find $from_dir$!");
......
...@@ -258,6 +258,7 @@ our $opt_result_ext; ...@@ -258,6 +258,7 @@ our $opt_result_ext;
our $opt_skip; our $opt_skip;
our $opt_skip_rpl; our $opt_skip_rpl;
our $use_slaves; our $use_slaves;
our $use_innodb;
our $opt_skip_test; our $opt_skip_test;
our $opt_skip_im; our $opt_skip_im;
...@@ -357,6 +358,7 @@ sub run_benchmarks ($); ...@@ -357,6 +358,7 @@ sub run_benchmarks ($);
sub initialize_servers (); sub initialize_servers ();
sub mysql_install_db (); sub mysql_install_db ();
sub install_db ($$); sub install_db ($$);
sub copy_install_db ($$);
sub run_testcase ($); sub run_testcase ($);
sub run_testcase_stop_servers ($$$); sub run_testcase_stop_servers ($$$);
sub run_testcase_start_servers ($); sub run_testcase_start_servers ($);
...@@ -427,6 +429,7 @@ sub main () { ...@@ -427,6 +429,7 @@ sub main () {
$need_ndbcluster||= $test->{ndb_test}; $need_ndbcluster||= $test->{ndb_test};
$need_im||= $test->{component_id} eq 'im'; $need_im||= $test->{component_id} eq 'im';
$use_slaves||= $test->{slave_num}; $use_slaves||= $test->{slave_num};
$use_innodb||= $test->{'innodb_test'};
} }
$opt_skip_ndbcluster= $opt_skip_ndbcluster_slave= 1 $opt_skip_ndbcluster= $opt_skip_ndbcluster_slave= 1
unless $need_ndbcluster; unless $need_ndbcluster;
...@@ -2235,9 +2238,10 @@ sub initialize_servers () { ...@@ -2235,9 +2238,10 @@ sub initialize_servers () {
sub mysql_install_db () { sub mysql_install_db () {
# FIXME not exactly true I think, needs improvements
install_db('master', $master->[0]->{'path_myddir'}); install_db('master', $master->[0]->{'path_myddir'});
install_db('master', $master->[1]->{'path_myddir'});
# FIXME check if testcase really is using second master
copy_install_db('master', $master->[1]->{'path_myddir'});
if ( $use_slaves ) if ( $use_slaves )
{ {
...@@ -2251,10 +2255,8 @@ sub mysql_install_db () { ...@@ -2251,10 +2255,8 @@ sub mysql_install_db () {
im_prepare_env($instance_manager); im_prepare_env($instance_manager);
} }
my $cluster_started_ok= 1; # Assume it can be started my $cluster_started_ok= 1; # Assume it can be started
if (ndbcluster_start_install($clusters->[0]) || if (ndbcluster_start_install($clusters->[0]) ||
$use_slaves && ndbcluster_start_install($clusters->[1])) $use_slaves && ndbcluster_start_install($clusters->[1]))
{ {
...@@ -2262,7 +2264,6 @@ sub mysql_install_db () { ...@@ -2262,7 +2264,6 @@ sub mysql_install_db () {
$cluster_started_ok= 0; $cluster_started_ok= 0;
} }
foreach my $cluster (@{$clusters}) foreach my $cluster (@{$clusters})
{ {
...@@ -2302,6 +2303,18 @@ sub mysql_install_db () { ...@@ -2302,6 +2303,18 @@ sub mysql_install_db () {
} }
sub copy_install_db ($$) {
my $type= shift;
my $data_dir= shift;
mtr_report("Installing \u$type Database");
# Just copy the installed db from first master
mtr_copy_dir($master->[0]->{'path_myddir'}, $data_dir);
}
sub install_db ($$) { sub install_db ($$) {
my $type= shift; my $type= shift;
my $data_dir= shift; my $data_dir= shift;
...@@ -2456,7 +2469,7 @@ sub im_prepare_data_dir($) { ...@@ -2456,7 +2469,7 @@ sub im_prepare_data_dir($) {
foreach my $instance (@{$instance_manager->{'instances'}}) foreach my $instance (@{$instance_manager->{'instances'}})
{ {
install_db( copy_install_db(
'im_mysqld_' . $instance->{'server_id'}, 'im_mysqld_' . $instance->{'server_id'},
$instance->{'path_datadir'}); $instance->{'path_datadir'});
} }
...@@ -2890,7 +2903,7 @@ sub mysqld_arguments ($$$$$) { ...@@ -2890,7 +2903,7 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--datadir=%s", $prefix, mtr_add_arg($args, "%s--datadir=%s", $prefix,
$master->[$idx]->{'path_myddir'}); $master->[$idx]->{'path_myddir'});
if ( $idx > 0 ) if ( $idx > 0 or !$use_innodb)
{ {
mtr_add_arg($args, "%s--skip-innodb", $prefix); mtr_add_arg($args, "%s--skip-innodb", $prefix);
} }
......
...@@ -446,52 +446,6 @@ INSERT INTO t1 VALUES(1, 1); ...@@ -446,52 +446,6 @@ INSERT INTO t1 VALUES(1, 1);
ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment; ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment;
ERROR 23000: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '1' for key 'PRIMARY' ERROR 23000: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '1' for key 'PRIMARY'
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment,
`a` int(11) default NULL,
`c` int(11) default NULL,
PRIMARY KEY (`k`),
UNIQUE KEY `idx_1` (`a`)
) ENGINE=InnoDB;
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
insert into t2 ( a ) values ( 7 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
last_insert_id()
2
select * from t2;
k a c
1 6 NULL
2 7 NULL
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
last_insert_id()
1
select * from t2;
k a c
1 6 1
2 7 NULL
insert ignore into t2 values (null,6,1),(10,8,1);
select last_insert_id();
last_insert_id()
1
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
select last_insert_id();
last_insert_id()
11
select * from t2;
k a c
1 6 1
2 7 NULL
10 8 1
11 15 1
12 20 1
drop table t2;
create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c)); create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c));
insert into t1 values(null,1,1,now()); insert into t1 values(null,1,1,now());
insert into t1 values(null,0,0,null); insert into t1 values(null,0,0,null);
......
...@@ -367,3 +367,49 @@ Warnings: ...@@ -367,3 +367,49 @@ Warnings:
Warning 1071 Specified key was too long; max key length is 765 bytes Warning 1071 Specified key was too long; max key length is 765 bytes
insert into t1 values('aaa'); insert into t1 values('aaa');
drop table t1; drop table t1;
CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment,
`a` int(11) default NULL,
`c` int(11) default NULL,
PRIMARY KEY (`k`),
UNIQUE KEY `idx_1` (`a`)
) ENGINE=InnoDB;
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
insert into t2 ( a ) values ( 7 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
last_insert_id()
2
select * from t2;
k a c
1 6 NULL
2 7 NULL
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
last_insert_id()
1
select * from t2;
k a c
1 6 1
2 7 NULL
insert ignore into t2 values (null,6,1),(10,8,1);
select last_insert_id();
last_insert_id()
1
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
select last_insert_id();
last_insert_id()
11
select * from t2;
k a c
1 6 1
2 7 NULL
10 8 1
11 15 1
12 20 1
drop table t2;
...@@ -304,42 +304,6 @@ INSERT INTO t1 VALUES(1, 1); ...@@ -304,42 +304,6 @@ INSERT INTO t1 VALUES(1, 1);
ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment; ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment;
DROP TABLE t1; DROP TABLE t1;
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
# UPDATE": now LAST_INSERT_ID() will return the id of the updated
# row.
CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment,
`a` int(11) default NULL,
`c` int(11) default NULL,
PRIMARY KEY (`k`),
UNIQUE KEY `idx_1` (`a`)
) ENGINE=InnoDB;
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
insert into t2 ( a ) values ( 7 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
select * from t2;
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
select * from t2;
# Test of LAST_INSERT_ID() when autogenerated will fail:
# last_insert_id() should not change
insert ignore into t2 values (null,6,1),(10,8,1);
select last_insert_id();
# First and second autogenerated will fail, last_insert_id() should
# point to third
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
select last_insert_id();
select * from t2;
drop table t2;
# Test of REPLACE when it does INSERT+DELETE and not UPDATE: # Test of REPLACE when it does INSERT+DELETE and not UPDATE:
# see if it sets LAST_INSERT_ID() ok # see if it sets LAST_INSERT_ID() ok
create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c)); create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c));
......
...@@ -320,3 +320,40 @@ create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb ...@@ -320,3 +320,40 @@ create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
character set utf8 collate utf8_general_ci; character set utf8 collate utf8_general_ci;
insert into t1 values('aaa'); insert into t1 values('aaa');
drop table t1; drop table t1;
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
# UPDATE": now LAST_INSERT_ID() will return the id of the updated
# row.
CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment,
`a` int(11) default NULL,
`c` int(11) default NULL,
PRIMARY KEY (`k`),
UNIQUE KEY `idx_1` (`a`)
) ENGINE=InnoDB;
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
insert into t2 ( a ) values ( 7 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
select * from t2;
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
select * from t2;
# Test of LAST_INSERT_ID() when autogenerated will fail:
# last_insert_id() should not change
insert ignore into t2 values (null,6,1),(10,8,1);
select last_insert_id();
# First and second autogenerated will fail, last_insert_id() should
# point to third
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
select last_insert_id();
select * from t2;
drop table t2;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment