Skip to content

Commit aa37b75

Browse files
Merge mysql.com:/home/my/mysql-5.0
into mysql.com:/home/my/mysql-5.1
2 parents 30b360b + f580486 commit aa37b75

24 files changed

Lines changed: 602 additions & 149 deletions

.bzrignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ libmysqld/get_password.c
469469
libmysqld/gstream.cc
470470
libmysqld/ha_archive.cc
471471
libmysqld/ha_berkeley.cc
472+
libmysqld/ha_blackhole.cc
472473
libmysqld/ha_example.cc
473474
libmysqld/ha_federated.cc
474475
libmysqld/ha_heap.cc

include/my_global.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -662,11 +662,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
662662
#define FN_LEN 256 /* Max file name len */
663663
#define FN_HEADLEN 253 /* Max length of filepart of file name */
664664
#define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN) */
665-
#ifdef PATH_MAX
666-
#define FN_REFLEN PATH_MAX/* Max length of full path-name */
667-
#else
668665
#define FN_REFLEN 512 /* Max length of full path-name */
669-
#endif
670666
#define FN_EXTCHAR '.'
671667
#define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */
672668
#define FN_CURLIB '.' /* ./ is used as abbrev for current dir */

mysql-test/lib/mtr_misc.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
sub mtr_full_hostname ();
1010
sub mtr_short_hostname ();
1111
sub mtr_init_args ($);
12-
sub mtr_add_arg ($$);
12+
sub mtr_add_arg ($$@);
1313
sub mtr_path_exists(@);
1414
sub mtr_script_exists(@);
1515
sub mtr_exe_exists(@);
@@ -51,7 +51,7 @@ ($)
5151
$$args = []; # Empty list
5252
}
5353

54-
sub mtr_add_arg ($$) {
54+
sub mtr_add_arg ($$@) {
5555
my $args= shift;
5656
my $format= shift;
5757
my @fargs = @_;

mysql-test/lib/mtr_stress.pl

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# -*- cperl -*-
2+
3+
# This is a library file used by the Perl version of mysql-test-run,
4+
# and is part of the translation of the Bourne shell script with the
5+
# same name.
6+
7+
use strict;
8+
use File::Spec;
9+
10+
# These are not to be prefixed with "mtr_"
11+
12+
sub run_stress_test ();
13+
14+
##############################################################################
15+
#
16+
# Run tests in the stress mode
17+
#
18+
##############################################################################
19+
20+
sub run_stress_test ()
21+
{
22+
23+
my $args;
24+
my $stress_basedir;
25+
my $stress_suitedir;
26+
27+
mtr_report("Starting stress testing\n");
28+
29+
if ( ! $::glob_use_embedded_server and ! $::opt_local_master )
30+
{
31+
$::master->[0]->{'pid'}= mysqld_start('master',0,[],[]);
32+
if ( ! $::master->[0]->{'pid'} )
33+
{
34+
mtr_error("Can't start the mysqld server");
35+
}
36+
}
37+
38+
my $stress_basedir=File::Spec->catdir($::opt_vardir, "stress");
39+
40+
#Clean up stress dir
41+
if ( -d $stress_basedir )
42+
{
43+
rmtree($stress_basedir);
44+
}
45+
mkpath($stress_basedir);
46+
47+
if ($::opt_stress_suite ne 'main' && $::opt_stress_suite ne 'default' )
48+
{
49+
$stress_suitedir=File::Spec->catdir($::glob_mysql_test_dir, "suite",
50+
$::opt_stress_suite);
51+
}
52+
else
53+
{
54+
$stress_suitedir=$::glob_mysql_test_dir;
55+
}
56+
57+
if ( -d $stress_suitedir )
58+
{
59+
#$stress_suite_t_dir=File::Spec->catdir($stress_suitedir, "t");
60+
#$stress_suite_r_dir=File::Spec->catdir($stress_suitedir, "r");
61+
#FIXME: check dirs above for existence to ensure that test suite
62+
# contains tests and results dirs
63+
}
64+
else
65+
{
66+
mtr_error("Specified test suite $::opt_stress_suite doesn't exist");
67+
}
68+
69+
if ( @::opt_cases )
70+
{
71+
$::opt_stress_test_file=File::Spec->catfile($stress_basedir, "stress_tests.txt");
72+
open(STRESS_FILE, ">$::opt_stress_test_file");
73+
print STRESS_FILE join("\n",@::opt_cases),"\n";
74+
close(STRESS_FILE);
75+
}
76+
elsif ( $::opt_stress_test_file )
77+
{
78+
$::opt_stress_test_file=File::Spec->catfile($stress_suitedir,
79+
$::opt_stress_test_file);
80+
if ( ! -f $::opt_stress_test_file )
81+
{
82+
mtr_error("Specified file $::opt_stress_test_file with list of tests does not exist\n",
83+
"Please ensure that file exists and has proper permissions");
84+
}
85+
}
86+
else
87+
{
88+
$::opt_stress_test_file=File::Spec->catfile($stress_suitedir,
89+
"stress_tests.txt");
90+
if ( ! -f $::opt_stress_test_file )
91+
{
92+
mtr_error("Default file $::opt_stress_test_file with list of tests does not exist\n",
93+
"Please use --stress-test-file option to specify custom one or you can\n",
94+
"just specify name of test for testing as last argument in command line");
95+
96+
}
97+
}
98+
99+
if ( $::opt_stress_init_file )
100+
{
101+
$::opt_stress_init_file=File::Spec->catfile($stress_suitedir,
102+
$::opt_stress_init_file);
103+
if ( ! -f $::opt_stress_init_file )
104+
{
105+
mtr_error("Specified file $::opt_stress_init_file with list of tests does not exist\n",
106+
"Please ensure that file exists and has proper permissions");
107+
}
108+
}
109+
else
110+
{
111+
$::opt_stress_init_file=File::Spec->catfile($stress_suitedir,
112+
"stress_init.txt");
113+
if ( ! -f $::opt_stress_init_file )
114+
{
115+
$::opt_stress_init_file='';
116+
}
117+
}
118+
119+
if ( $::opt_stress_mode ne 'random' && $::opt_stress_mode ne 'seq' )
120+
{
121+
mtr_error("You specified wrong mode $::opt_stress_mode for stress test\n",
122+
"Correct values are 'random' or 'seq'");
123+
}
124+
125+
mtr_init_args(\$args);
126+
127+
mtr_add_arg($args, "--server-socket=%s", $::master->[0]->{'path_mysock'});
128+
mtr_add_arg($args, "--server-user=%s", $::opt_user);
129+
mtr_add_arg($args, "--server-database=%s", "test");
130+
mtr_add_arg($args, "--stress-suite-basedir=%s", $::glob_mysql_test_dir);
131+
mtr_add_arg($args, "--suite=%s", $::opt_stress_suite);
132+
mtr_add_arg($args, "--stress-tests-file=%s", $::opt_stress_test_file);
133+
mtr_add_arg($args, "--stress-basedir=%s", $stress_basedir);
134+
mtr_add_arg($args, "--server-logs-dir=%s", $stress_basedir);
135+
mtr_add_arg($args, "--stress-mode=%s", $::opt_stress_mode);
136+
mtr_add_arg($args, "--mysqltest=%s", $::exe_mysqltest);
137+
mtr_add_arg($args, "--threads=%s", $::opt_stress_threads);
138+
mtr_add_arg($args, "--verbose");
139+
mtr_add_arg($args, "--cleanup");
140+
mtr_add_arg($args, "--log-error-details");
141+
mtr_add_arg($args, "--abort-on-error");
142+
143+
if ( $::opt_stress_init_file )
144+
{
145+
mtr_add_arg($args, "--stress-init-file=%", $::opt_stress_init_file);
146+
}
147+
148+
if ( $::opt_stress_loop_count )
149+
{
150+
mtr_add_arg($args, "--loop-count=%s", $::opt_stress_loop_count);
151+
}
152+
153+
if ( $::opt_stress_test_count )
154+
{
155+
mtr_add_arg($args, "--test-count=%s", $::opt_stress_test_count);
156+
}
157+
158+
if ( $::opt_stress_test_duration )
159+
{
160+
mtr_add_arg($args, "--test-duration=%s", $::opt_stress_test_duration);
161+
}
162+
163+
#Run stress test
164+
mtr_run("$::glob_mysql_test_dir/mysql-stress-test.pl", $args, "", "", "", "");
165+
166+
if ( ! $::glob_use_embedded_server )
167+
{
168+
stop_masters();
169+
}
170+
}
171+
172+
1;

mysql-test/mysql-test-run.pl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
require "lib/mtr_diff.pl";
9797
require "lib/mtr_match.pl";
9898
require "lib/mtr_misc.pl";
99+
require "lib/mtr_stress.pl";
99100

100101
$Devel::Trace::TRACE= 1;
101102

@@ -271,6 +272,16 @@
271272
our $opt_valgrind_all;
272273
our $opt_valgrind_options;
273274

275+
our $opt_stress= "";
276+
our $opt_stress_suite= "main";
277+
our $opt_stress_mode= "random";
278+
our $opt_stress_threads= 5;
279+
our $opt_stress_test_count= 20;
280+
our $opt_stress_loop_count= "";
281+
our $opt_stress_test_duration= "";
282+
our $opt_stress_init_file= "";
283+
our $opt_stress_test_file= "";
284+
274285
our $opt_verbose;
275286

276287
our $opt_wait_for_master;
@@ -391,6 +402,10 @@ ()
391402
{
392403
run_benchmarks(shift); # Shift what? Extra arguments?!
393404
}
405+
elsif ( $opt_stress )
406+
{
407+
run_stress_test()
408+
}
394409
else
395410
{
396411
run_tests();
@@ -547,6 +562,17 @@ ()
547562
'valgrind-all:s' => \$opt_valgrind_all,
548563
'valgrind-options=s' => \$opt_valgrind_options,
549564

565+
# Stress testing
566+
'stress' => \$opt_stress,
567+
'stress-suite=s' => \$opt_stress_suite,
568+
'stress-threads=i' => \$opt_stress_threads,
569+
'stress-test-file=s' => \$opt_stress_test_file,
570+
'stress-init-file=s' => \$opt_stress_init_file,
571+
'stress-mode=s' => \$opt_stress_mode,
572+
'stress-loop-count=i' => \$opt_stress_loop_count,
573+
'stress-test-count=i' => \$opt_stress_test_count,
574+
'stress-test-duration=i' => \$opt_stress_test_duration,
575+
550576
# Misc
551577
'big-test' => \$opt_big_test,
552578
'debug' => \$opt_debug,

mysql-test/r/csv.result

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4976,3 +4976,27 @@ c1
49764976
4
49774977
5
49784978
DROP TABLE bug14672;
4979+
create table t1 (a int) engine=csv;
4980+
insert t1 values (1);
4981+
delete from t1;
4982+
affected rows: 1
4983+
delete from t1;
4984+
affected rows: 0
4985+
insert t1 values (1),(2);
4986+
delete from t1;
4987+
affected rows: 2
4988+
insert t1 values (1),(2),(3);
4989+
flush tables;
4990+
delete from t1;
4991+
affected rows: 3
4992+
insert t1 values (1),(2),(3),(4);
4993+
flush tables;
4994+
select count(*) from t1;
4995+
count(*)
4996+
4
4997+
delete from t1;
4998+
affected rows: 4
4999+
insert t1 values (1),(2),(3),(4),(5);
5000+
truncate table t1;
5001+
affected rows: 0
5002+
drop table t1;

mysql-test/r/federated.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ CREATE TABLE federated.t1 (
4040
)
4141
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
4242
CONNECTION='mysql://[email protected]:SLAVE_PORT/federated/t3';
43-
ERROR HY000: Can't create federated table. Foreign data src error : ': 1146 : Table 'federated.t3' doesn't exist'
43+
ERROR HY000: Can't create federated table. Foreign data src error: error: 1146 'Table 'federated.t3' doesn't exist'
4444
CREATE TABLE federated.t1 (
4545
`id` int(20) NOT NULL,
4646
`name` varchar(32) NOT NULL default ''
4747
)
4848
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
4949
CONNECTION='mysql://user:[email protected]:SLAVE_PORT/federated/t1';
50-
ERROR HY000: Unable to connect to foreign data source - database ' database federated username user hostname 127.0.0.1'!
50+
ERROR HY000: Unable to connect to foreign data source: database: 'federated' username: 'user' hostname: '127.0.0.1'
5151
DROP TABLE IF EXISTS federated.t1;
5252
Warnings:
5353
Note 1051 Unknown table 't1'

mysql-test/r/grant.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ Grants for drop_user@localhost
238238
GRANT USAGE ON *.* TO 'drop_user'@'localhost'
239239
drop user drop_user@localhost;
240240
revoke all privileges, grant option from drop_user@localhost;
241-
ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
241+
ERROR HY000: Can't revoke all privileges for one or more of the requested users
242242
grant select(a) on test.t1 to drop_user1@localhost;
243243
grant select on test.t1 to drop_user2@localhost;
244244
grant select on test.* to drop_user3@localhost;
@@ -247,7 +247,7 @@ drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
247247
drop_user4@localhost;
248248
revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
249249
drop_user3@localhost, drop_user4@localhost;
250-
ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
250+
ERROR HY000: Can't revoke all privileges for one or more of the requested users
251251
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
252252
drop_user4@localhost;
253253
ERROR HY000: Operation DROP USER failed for 'drop_user1'@'localhost','drop_user2'@'localhost','drop_user3'@'localhost','drop_user4'@'localhost'

mysql-test/r/grant2.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ flush privileges;
191191
show grants for 'mysqltest_1';
192192
ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host '%'
193193
revoke all privileges, grant option from 'mysqltest_1';
194-
ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
194+
ERROR HY000: Can't revoke all privileges for one or more of the requested users
195195
drop user 'mysqltest_1';
196196
select host,db,user from mysql.db where user = 'mysqltest_1' order by host,db,user;
197197
host db user

mysql-test/t/csv.test

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,3 +1352,35 @@ SELECT * FROM bug14672;
13521352
DROP TABLE bug14672;
13531353

13541354
# End of 4.1 tests
1355+
1356+
#
1357+
# BUG#13406 - incorrect amount of "records deleted"
1358+
#
1359+
1360+
create table t1 (a int) engine=csv;
1361+
insert t1 values (1);
1362+
--enable_info
1363+
delete from t1; -- delete_row
1364+
delete from t1; -- delete_all_rows
1365+
--disable_info
1366+
insert t1 values (1),(2);
1367+
--enable_info
1368+
delete from t1; -- delete_all_rows
1369+
--disable_info
1370+
insert t1 values (1),(2),(3);
1371+
flush tables;
1372+
--enable_info
1373+
delete from t1; -- delete_row
1374+
--disable_info
1375+
insert t1 values (1),(2),(3),(4);
1376+
flush tables;
1377+
select count(*) from t1;
1378+
--enable_info
1379+
delete from t1; -- delete_all_rows
1380+
--disable_info
1381+
insert t1 values (1),(2),(3),(4),(5);
1382+
--enable_info
1383+
truncate table t1; -- truncate
1384+
--disable_info
1385+
drop table t1;
1386+

0 commit comments

Comments
 (0)